We have an ASP.NET application with SQL Server 2008 back end. We have the following setup in our SpecimenEvents table:
EventID SpecimenID EventType
1 101 A
2 102 A
3 103 A
4 101 B
5 103 B
6 101 C
Given a list of SpecimenIDs as input -- how would you write a query to return just those EventType(s) COMMON to all SpecimenIDs in the input list? For example:
a SpecimenID input list of (101,102,103) should return 'A'
a SpecimenID input list of (101) should return 'A','B','C'
a SpecimenID input list of (101,103) should return 'A', 'B' ...