T-SQL Where statement - OR
- by Zyphrax
Sorry for the vague title but I really didn't know what title to give to this problem:
I have the following result set:
ID Data Culture
1 A nl-NL
2 B nl-NL
3 C nl-NL
4 A en-GB
5 B en-GB
6 A en
7 B en
8 C en
9 D en
10 A nl
I would like to mimic the ASP.Net way of resource selection, user Culture (nl-NL)
SELECT Data FROM Tbl WHERE Culture = 'nl-NL'
Or when there are no results for the specific culture, try the parent Culture (nl)
SELECT Data FROM Tbl WHERE Culture = 'nl'
Or when there are no results for the parent culture, try the default Culture (en)
SELECT Data FROM Tbl WHERE Culture = 'en'
How can I combine these SELECT-statements in one T-SQL statement?
I'm using LINQ so a LINQ expression would be even greater.
The OR-statement won't work, because I don't want a mix of cultures.
The ORDER BY-statement won't help, because it returns multiple records per culture.