I have a select query to select an ID and corresponding count and group them based on ID and this is the sql for that
SELECT InID, COUNT(*) as ICount FROM RawData WHERE CompletedDate>= @BeginDate AND CompletedDate<= @EndDate AND InID in (3851,4151,11) GROUP BY InID This returns only one record for me
4151 225 To find the missing entries ie 3851 and 11 , i tried the query
SELECT InID, COUNT(*) as ICount FROM RawData WHERE CompletedDate>= @BeginDate AND CompletedDate<= @EndDate AND InID in (3851,4151,11) GROUP BY InID HAVING COUNT(*)=0 But it returned 0 records. So to check the IDs with missing records in a group by what is the proper way