Selecting only the entries that have a distinct combination of values?
Posted
by
Theodore E O'Neal
on Stack Overflow
See other posts from Stack Overflow
or by Theodore E O'Neal
Published on 2012-11-10T04:31:12Z
Indexed on
2012/11/10
4:59 UTC
Read the original article
Hit count: 68
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?
© Stack Overflow or respective owner