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 Field FieldValue Culture
1 Color Groen nl-NL
2 Taste Kip nl-NL
3 Color Green en-GB
4 Taste Chicken en-GB
5 Color Green en
6 Taste Chicken en
I would like to mimic the ASP.Net way of resource selection, user Culture (nl-NL)
SELECT Field, FieldValue FROM Tbl WHERE Culture = 'nl-NL'
Or when there are no results for the specific culture, try the parent Culture (nl)
SELECT Field, FieldValue FROM Tbl WHERE Culture = 'nl'
Or when there are no results for the parent culture, try the default Culture (en)
SELECT Field, FieldValue 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.
The output might look like (nl-NL):
Color Groen
Taste Kip
or (en-GB / en):
Color Green
Taste Chicken