Take a look at the following MS SQL query: SELECT MT.MeetingTypeName, COUNT(DISTINCT(A.MemberId)) AS AttendanceTotal FROM MeetingAttendance AS MA INNER JOIN MeetingType AS MT ON MA.MeetingTypeId = MT.MeetingTypeId WHERE (MA.MeetingDate = @meetingDate) AND (MT.MeetingTypeId IN (1,2,3)) What if the IN clause in the above query needs to be dynamic? Can you use a parameter for the IN clause like this? SELECT MT.MeetingTypeName, COUNT(DISTINCT(A.MemberId)) AS AttendanceTotal FROM MeetingAttendance AS MA INNER JOIN MeetingType AS MT ON MA.MeetingTypeId […]
Daily Archives: September 15, 2010
1 post