Selecting only the entries that have a distinct combination of values?
- by Theodore E O'Neal
I have a table, links1, that has the columns headers CardID and AbilityID, that looks like this:
CardID | AbilityID
1001 | 1
1001 | 2
1001 | 3
1002 | 2
1002 | 3
1002 | 4
1003 | 3
1003 | 4
1003 | 5
What I want is to be able to return all the CardID that that have two specific AbilityID.
For example:
If I choose 1 and 2, it returns 1001.
If I choose 3 and 4, it returns 1002 and 1003.
Is it possible to do this with only one table, or will I need to create an identical table and do an INNER JOIN on those?