mysql - MySQL 中 Distinct 的对立面

标签 mysql

我想知道在 sql 中是否有与“select distinct”相反的东西,这样我就可以用来从重复多次的表中获取值。

谢谢

最佳答案

select some_column, count(*)
from some_table
group by 1
having count(*) > 1;

在像 mysql 这样的数据库上,您甚至可以省略选择 count(*) 以保留列值:

select some_column
from some_table
group by 1
having count(*) > 1;

关于mysql - MySQL 中 Distinct 的对立面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7411639/

相关文章:

没有网络服务器的 mysql 访问(例如 Apache)

mysql - 如何从表名为变量的 MySQL 中进行选择

mysql - 为 MySQL 恢复已删除的 'root' 用户和密码

php - 使用if语句向数据库中插入数据

mysql - 如何将两个独立的 mysql count 查询结果合并到一个 View 中

MySQL判断满足哪个条件

php, "thread safe"SQL操作

mysql更新语句在同一个表上使用from子句

Python 3.4 (Anaconda) - MySQL 连接器

MySQL 只加入最近的行?