title: MySQL: How to use column alias in left join?
body: <p>I am trying to use column alias in the left join but I get sql error with uknown field.</p>
  
  <pre><code>select *, (select SenderId from messages where messageId = 5) as senderId  from threads 
  Left join users where users.id = senderId
  </code></pre>
  
  <p>This query is quite simple but why is not it working or what is the best way to achieve this ?</p>
  
  <p>I'll really appreciate any contribution.
  Thanks</p>