Hi - I'm having issues selecting duplicate records from a specific date using a group by / having.
select * from [dbo].[entrytable]
WHERE (CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, entrytime))) = CONVERT(DateTime, DATEDIFF(DAY, 2, GETDATE())))
and stat != 'allowed' and staffnumber
IN (SELECT staffnumber
GROUP BY staffnumber
HAVING COUNT(staffnumber ) > 1)
As you can see the select should be selecting records from 2 days before today which works fine but the group by seams to be grouping all records irrespective of the date.
Can anyone help ?