I’m selecting products from a database table. Currently the query is launched from Coldfusion, where I have an “optional LEFT JOIN” like so:
SELECT a.products
FROM artikelstammdaten a
<cfif modul_aktiv("preorder", my_module) IS "true">
LEFT JOIN...
</cfif>
WHERE ...
Question:
Is it possible to do an optional LEFT JOIN in MySQL. I’m thinking something like this:
SELECT a.products
FROM artikelstammdaten a
AND (
((param_preorder = 'false') "(1=2)" )
OR LEFT JOIN ...
)
WHERE ...
Well, you can do something like this:
The LEFT JOIN will be done, whatever your condition is, but if it is false, it won’t bring back any record.
But you certainly can’t emulate the
cfifin pure SQL 🙂