say I had a table ie
___________________
| ID | Name | Job |
+====+======+=====+
| 01 | Fred | br |
+====+======+=====+
| 02 | Jack | pd |
+====+======+=====+
and I run a query like
SELECT
CASE Job
WHEN 'br' THEN 'cleaner'
WHEN 'pd' THEN 'teacher'
ELSE Job
END as new_job
CONCAT( Name, 'is a', new_job )
FROM table
I get an error as I can’t use new_job in my concat is there anyway to do this?
Thnaks in advance 🙂
Wrap it as subquery: