I am trying to list in a single query based on the selected language. But I need to do, if the listing is not available for the selected language, then it will return English, if one exists.
So, if English is "en" and Japanese is "jp", the following Japanese lists are currently:
SELECT *
FROM listings LS
LEFT JOIN listing_langs LANG ON LS.listing_id = LANG.listing_id
WHERE LANG.language = 'jp'
I am trying to figure out, even in MySQL, to configure a query so that it first looks for: LANG.language = 'jp' and returns the Japanese list (as it is now), but if that appears empty and then looks for: LANG.language = 'en' and instead returns this English list, if one exists.
So, in principle, return the Japanese list if it exists, but if it is not listed by default, if it exists.
Frank source
share