如何为列的相同值选择所有行?

时间:2016-03-18 14:23:59

标签: mysql

如何选择列中具有相同值的所有行?

SELECT * FROM messages WHERE count(mcc) > 1 // total all same of value for column mcc > 1

enter image description here

仅338,338,338,340,340等。不是330,316,334因为它们没有相同的值

1 个答案:

答案 0 :(得分:2)

您可以尝试此查询: -

SELECT * FROM messages 
WHERE mcc in (SELECT mcc FROM messages
              GROUP BY mcc
              HAVING COUNT(mcc) > 1)