首页 > 数据库技术 > 详细

sql 使用group by,having,count函数查询表中某字段相同内容的数据

时间:2020-06-28 13:13:09      阅读:76      评论:0      收藏:0      [点我收藏+]

方法一:

select  n_code from table1(表名) where  n_orgid is not null
                group by n_code,n_orgid
                         having count(n_orgid)>1
 

方法二

select *  from 
        (select count(n_code) asfrom table1(表名) 
                group by n_code,n_orgid) as tt
                                 where c>1;
 

 

sql 使用group by,having,count函数查询表中某字段相同内容的数据

原文:https://www.cnblogs.com/qingjiawen/p/13202039.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!