44、华为一道面试题
一个表中的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
44、华为一道面试题
一个表中的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