Setup: An order has multiple samples, with each sample having a test. A specific combination of tests is a specific testcode. How can I match a set of rows with specific values with another table of specific values to give a single result?
Table: TestCodes
ID TestCode Test 1 01a A 2 01b F 3 02a A 4 02a B 5 02b A 6 02b C 7 02c A 8 02c E 9 03a A 10 03a C 11 03a B 12 03a D 13 03b A 14 03b C 15 03b E 16 03c A 17 03c B 18 03c E 19 04 A 20 04 C 21 04 B 22 04 D 23 04 E
Table: Orders
Order Sample Test 1 1 A 1 2 B 1 3 C 1 4 D 1 5 E 2 1 A 2 2 E
I can't find a way to return
Order TestCode 1 04 2 02c
I've tried TSQL views, but can't find a way to compare a set of values in one table to a set of values in another table. Thanks!