>>SELECT tlp.PersonID, tlp.Program, >> ( SELECT COUNT(*) FROM dbo.tmmLicesnses2Persons tlp2 >> WHERE tlp2.Program = tlp.Program >> AND (DateActivated IS NOT NULL) AND (DateDeactivated IS NULL)) AS ProgramCount >> FROM dbo.tmmLicesnses2Persons tlp >> WHERE (DateActivated IS NOT NULL) AND (DateDeactivated IS NULL) >> GROUP BY PersonID, Program >>>This is the solution I was looking for, simple and correct. I have actually done this before, but could not wrap my mind around it this morning. Thank you Sergey!