select * from t a where (select count(*) from t where nName=a.nName and datediff(day,nDate,a.nDate)=0)>1
select * from tbl a,(select nname from tbl group by nname having count(nname)>1) b where a.nname=b.nname
select count(nName),nID,nDate,nTime,nName from table group by nName having count(nName)>1 and nTime between cast('00:00:00' as datetime) and cast('23:59:59' as datetime)
select * from table1 where nid in (select nid from talbe1 group by nname,ndate having(count(*)>1))
select * from (select max(nName) as Nname from 表名 group by sortid having count(sortid)>1) as a left join 表名on sortid=nName
select nDate,count(*) from TableName group by nDate, nName having count(*)>1
select nDate,count(*),nName from TableName group by nDate, nName having count(*)>1
from t a
where (select count(*) from t where nName=a.nName and datediff(day,nDate,a.nDate)=0)>1
where a.nname=b.nname
select count(nName),nID,nDate,nTime,nName
from table
group by nName
having count(nName)>1 and nTime between cast('00:00:00' as datetime) and cast('23:59:59' as datetime)
(select nid from talbe1 group by nname,ndate having(count(*)>1))
having count(*)>1
having count(*)>1