Very niceCREATE TABLE #myTable99( ReviewListAppId int, ReviewListId int, ApplicantId int, StatusId int, CreatedOn datetime)GOINSERT INTO #myTable99( ReviewListAppId, ReviewListId, ApplicantId, StatusId, CreatedOn)SELECT 1 , 2 , 6 , 1 , '1/1/2010' UNION ALLSELECT 2 , 2 , 6 , 3 , '1/1/2010' UNION ALLSELECT 3 , 2 , 6 , 3 , '1/2/2010' UNION ALLSELECT 4 , 3 , 7 , 1 , '1/2/2010' UNION ALLSELECT 5 , 4 , 8 , 3 , '1/2/2010' UNION ALLSELECT 6 , 4 , 8 , 3 , '1/3/2010'GOSELECT ApplicantId, COUNT(StatusId), COUNT(CASE WHEN StatusId = 3 THEN 1 END)FROM #myTable99GROUP BY ApplicantIdSELECT ApplicantIdFROM #myTable99GROUP BY ApplicantIdHAVING COUNT(StatusId) = COUNT(CASE WHEN StatusId = 3 THEN 1 END)DROP TABLE #myTable99GO
Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam