How can I pass a "solver" to a where clause from the following mysql query?
SELECT *, CASE WHEN (cond1) THEN 1 WHEN (cond2) THEN 2 ELSE NULL END as decider FROM t1, t2 WHERE cond12 HAVING decider IS NOT NULL
- The earliest MySQL allows column aliases - this is a suggestion
- You need to use
IS NOT NULL
(optionally) because it is
not a value - it is a placeholder for missing any value that requires special handling in SQL
source to share