日期:2014-05-18  浏览次数:20730 次

菜鸟求条简单sql语句
某个笔试题:在大型数据库中,用存储过程将出现过两次以上相同内容的记录,全部提取出来。
题目好像是这个,记不清了。拜托大家了。

------解决方案--------------------
http://topic.csdn.net/u/20080626/00/43d0d10c-28f1-418d-a05b-663880da278a.html?6764
------解决方案--------------------
SQL code

select * from Table as M inner join (select Id,count(1) as Cnt from Table group by a,d,c,d...) as Temp
on M.Id = Temp.Id and Temp.Cnt > 1

------解决方案--------------------
条件 count=(select count(id) from 表)>1的
------解决方案--------------------
having 应该要用到这个
------解决方案--------------------
group by ***having count(。)>1
------解决方案--------------------
select col1,col2... from t group by .... having count(你的列)>1