简体   繁体   English

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

[英]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 . 仅338、338、338、340、340等。 Not 330, 316, 334 coz they haven't same values 不是330、316、334 coz,它们具有不同的值

You can try this query:- 您可以尝试以下查询:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 选择所有列值相同的行 - Select all rows where the value of column is the same Select 所有行在一列中包含相同的值 - Select all rows contains same value in a column SQL-如何选择列中具有value1但同一列中没有value2的所有行? - SQL - how to select all rows which have value1 in column but not value2 in same column? 如果某一列包含特定值,则选择具有相同ID的所有行 - Select all rows with same IDs if one column contains a particular value 选择MySQL中列值“相同”的所有行? - Select all rows where the column value is the "same" in MySQL? 仅当 Select 记录包含所有行的相同列值时 - Select record only if it contains same column value for all rows 如何从数据库MySQL的特定列中选择具有相同和最新值的所有行 - How to select all the rows having same and latest value in a particular column from database mysql 如何选择具有相同值的所有列值的行? - How can I select rows with all Column value, which have the same values? 如何选择不同的行,其中一列可能具有许多相同的值,但所有第二列均具有相同的值? - How do I select distinct rows where a column may have a number of the same values but all their 2nd columns have the same value? 当需要多个具有相同列值的行时,如何使用LIMIT进行选择? - How to SELECT with a LIMIT while needing multiple rows with a same column value?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM