title: Unknown Column In Where Clause With Join
body: <p>I want to join 3 table one column sum has to be compare with another column</p>
  
  <p>Here is my query</p>
  
  <pre><code>SELECT 
      *, `e`.`id` AS `event_ac_id`, 
      SUM(CASE WHEN trans.gift_transaction_status = 1 
                 THEN trans.event_gift_amount  
                 ELSE 0 END) as amount 
  FROM 
      `tbl_event_category` `cat` 
  LEFT JOIN 
      `tbl_event` `e` ON e.event_category = cat.id 
  LEFT JOIN 
      `tbl_organisation` `org` ON e.organisation_id = org.id 
  LEFT JOIN 
      `tbl_event_gift_transaction` `trans` ON e.id = trans.event_id 
  WHERE 
      cat.type ='campaign' AND is_approved=1
      AND e.funding_goal_amount &lt;= amount 
  GROUP BY 
      `event_ac_id` 
  LIMIT 8
  </code></pre>
  
  <blockquote>
    <p>Exception (Database Exception) 'yii\db\Exception' with message
    'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'amount' in
    'where clause'</p>
  </blockquote>