I have simplified this a bit to frame the question. There are more tables involved but this is the core of the problem:
So I have a table with just 2 columns in it in MSSQL 2008.
GroupID | Culture
1 | en-gb
2 | fr-fr
3 | en-gb
3 | fr-fr
4 | en-gb
4 | fr-fr
4 | es-es
I have no idea what the Group ID is but I want to be able to do the following:
1) Select en-gb only – returning me the unique row with the GroupId of 1 and NOT the rows with GroupIDs 3 and 4
2) Select en-gb AND fr-fr to give me the GroupID of 3
I did have a look around for any examples of this – but its possible Im not even thinking of the correct search terms. thanks.
Assuming you are searching for
'en-gb','fr-fr'below.One way
(Edit: Removed
DISTINCTfollowing confirmation that a unique constraint exists to guarantee this isn’t needed)