MYSQL返回重复行 [英] MYSQL returning duplicate rows
本文介绍了MYSQL返回重复行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MYSQL中有一个数据库表,它看起来像这样:
I have a Database table in MYSQL, it looks like this:
Project_ID user_ID name
11 1 fred
11 2 rick
11 1 fred
表,但是当我显示它,我得到相同的名称两次,因为user_ID 1
在表中出现两次。我试图用 GROUP BY
和 SUM
显示它,但我不想这样做。
I want to get the names in the table, but when I display it I get the same name twice because the user_ID 1
appears twice in the table. I tried to display it with GROUP BY
and SUM
, but I don't want to do it this way. How do I get it not to return duplicate rows?
推荐答案
使用 DISTINCT
SELECT DISTINCT user_ID
, verschil_ma
FROM project_uren
WHERE project_ID = 11
GROUP BY user_ID
这篇关于MYSQL返回重复行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文