title: unknown column in where clause with case + union + like
body: <p>I am working on sql query in mysql . My query is like this,</p>
  
  <pre><code>select reqId,sDate,stitle,sType,status,reqUser,assignedTo from 
  (select request_id as reqId,date as sDate,title as sTitle,type as sType,status as status,request_user as reqUser ,
  case when status='posted' then fbuser.name
       when status='awaiting approval' then fbmanager.name
       when status='approved' then fbAdmin.name
       when status='rejected' then fbAdmin.name
  else null
  end as assignedTo
  from fb_requests fr
  left join users fbuser on (fr.reqUser = fbuser.id)
  left join users fbmanager on (fr.managerid= fbmanager.id)
  left join users fbAdmin on (fr.adminin = fbAdmin.id)
  where 1=1
  and ( upper(assignedTo) like upper('abc') )
  UNION
  select request_id as reqId,date as sDate,title as sTitle,type as sType,status as status,request_user as reqUser ,
  case when status='posted' then fbuser.name
       when status='awaiting approval' then fbmanager.name
  else null
  end as assignedTo
  from fb_wall_posts fw
  left join users fbuser on (fw.request_by_id = fbuser.id)
  left join users fbmanager on (fw.manager_id= fbmanager.id)
   where 1=1
  and ( upper(assignedTo) like upper('abc') ))
  </code></pre>
  
  <p>here I am getting 'unknown column assignedTo' . can anyone help me out how to resolve this. Thanks in advance for valueble reply.</p>