现在的位置: 首页 > 综合 > 正文

华为一道面试题

2012年11月25日 ⁄ 综合 ⁄ 共 199字 ⁄ 字号 评论关闭

一个表中的Id有多个记录,把所有这个id的记录查出来,并显示共有多少条记录数。
------------------------------------------

 

select id, Count*) from tb group by id having count(*)>1
select * from(select count(ID) as count from table group by ID)T where T.count>1

 

抱歉!评论已关闭.