我有这样一张表:
我只想返回只有4个相同日期的记录
请问怎么实现?
------解决方案--------------------
select username,din,clock from tb group by username,din,clock
having count(*)=4
------解决方案--------------------
select * from tb t1 where (select count(1) from tb t2 where t1.username=t2.username and convert(varchar(10),t1.clock,120)=convert(varchar(10),t2.clock,120))=4