I was wondering how I would return the result of the left most condition in a OR clause used in a LEFT JOIN if both evaluate to be true.
The solutions I've come upon thus far both involve using CASE statement in the SELECT, this does mean I'd abandon the OR clause.
The other solution involved using a CASE statement in an ORDER BY.
Is there any other solutions that would cut down on the use of CASE statements. Reason I ask is because as or now there's only two LEFT JOINs but over time more will be added.
SELECT item.id, item.part_number, lang.data AS name, lang2.data AS description
FROM item AS item
LEFT JOIN language AS lang ON item.id = lang.item AND (lang.language = 'fr' OR lang.language = 'en')
LEFT JOIN language AS lang2 ON item.id = lang2.item AND (lang2.language = 'fr' OR lang2.language = 'en')
WHERE item.part_number = '34KM003KL'