I’m trying to get records from a table that have a language column. If there is a row with a specific lang code (e.g. US ) i want those rows, but if there is not i need to get the rows with the wildcard lang code (“*”) .
Is this doable in one query without filtering the results after the query?
I don’t think it can be done, but any ideas that would retrieve data this way in one query would be appreciated.
The basic answer is pretty simple; wrap the various sections of the OR statements in brackets. And then take a good look as its one of the places people tend to make mistakes – always double check your brackets 🙂
Sorry – missed that requirement and have edited my answer to address it. Now the brackets start to matter …