I need to return an alias column eventTitle of which the content can be variable depending on whether another column's value is null. I also need to use the value of that alias to concatenate some other values to return another alias title.
I am running the following query:
$sql = 'SELECT CASE WHEN session.title IS NOT NULL THEN session.title ELSE course.title END AS eventTitle, CONCAT(eventTitle, "\n", session.city, ", ", session.state) AS title, FROM session LEFT JOIN course ON course.id = session.course_id'; I get the following error:
Unknown column 'eventTitle' in 'field list'