问题:
博主在2011年6月,广东技术师范大学大四的时候,从学校计算机科学学院网站看到招聘信息并到广东中原地产IT部面试,很清楚记得当时的面试题目:怎么从数据库里面查询重复记录。html
解决方案:
在sql server中,能够用group by和having来解决问题。面试
脚本:
sql
/* 脚原本源:https://www.cnblogs.com/zhang502219048/p/11100778.html */ create table #t ( ID int ) --准备好测试数据 insert into #t values (1), (2), (3), (2), (1) --使用group by和having查询重复记录 select ID from #t group by ID having count(*) > 1 drop table #t
【转载请注明博文来源:http://www.javashuo.com/article/p-taachaut-ko.html】数据库