Two tables:
a
id
b
id
a_id
url
The urls in table b have a pattern like:
.../en-us/...
.../en-gb/...
.../de-at/...
.../de-de/...
.../ja-jp/...
Query:
SELECT b.url
FROM a
JOIN b ON b.a_id = a.id
How can I further narrow these results to select the url like %/en-us/%
first, then like %/en-%/%
if en-us does not exist? In other words, if I have two urls, one for both en-us and en-gb, how can I "prioritize" en-us over en-gb and only show one or the other?