简体   繁体   中英

How to select all rows for same value of column?

How to select all rows that have the same value in a column?

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

在此处输入图片说明

only 338, 338, 338, 340, 340 etc . Not 330, 316, 334 coz they haven't same values

You can try this query:-

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM