问个简单的sql查询,怎么查数据库中不重复的列值
答案:2 悬赏:80 手机版
解决时间 2021-02-16 21:00
- 提问者网友:暮烟疏雨之际
- 2021-02-15 20:29
问个简单的sql查询,怎么查数据库中不重复的列值
最佳答案
- 五星知识达人网友:末日狂欢
- 2021-02-15 20:36
如果得到所有值不重复。
select cc from tablename group by cc
或
select distinct cc form tablename
如果得到没有重复的所有制,
select cc from tablename group by cc
minus
select cc
from(
select cc,count(*) from tablename group by cc having count(*)>1) A
select cc from tablename group by cc
或
select distinct cc form tablename
如果得到没有重复的所有制,
select cc from tablename group by cc
minus
select cc
from(
select cc,count(*) from tablename group by cc having count(*)>1) A
全部回答
- 1楼网友:英雄的欲望
- 2021-02-15 21:58
select * from 表名 where 重复列名 in (
select 重复列名 from 表名 group by 重复列名 having count(*)>1
) order by 重复列名;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯