How can I use an alias for a CONCAT in MySQL?
<p>I need to return an alias column <code>eventTitle</code> of which the content can be variable depending on whether another column's value is <code>null</code>. I also need to use the value of that alias to concatenate some other values to return another alias <code>title</code>.</p>

<p>I am running the following query:</p>

<pre><code>$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';
</code></pre>

<p>I get the following error:</p>

<blockquote>
  <p>Unknown column 'eventTitle' in 'field list'</p>
</blockquote>