title: use nested IF in select query mysql
body: <p>How can I use nested IF in part of select in query MySQL? </p>
  
  <p>I do this, but It doesn't work </p>
  
  <p>this is the code: </p>
  
  <pre><code>SELECT *, IF(`view_price_trp` &lt;= 0 ,IF(`view_price_sgl` &gt; 0,
  (((`tour_package`.`view_dbl` * 2) + (`tour_package`.`view_sgl`)+
  (`tour_package`.`view_dbl` * 2)) + ((`tour_package`.`price_b`))), NULL) ,
  (((`tour_package`.`view_trp` * 3)+(`tour_package`.`view_dbl` * 2)) + 
  ((`tour_package`.`price_b`)))) As sumFieldPrice FROM `tbl_price`  WHERE 
  ((`tour_package`.`id` IN ('1420', '1421') HAVING (`sumFieldPrice` &gt;= 10) AND 
  (`sumFieldPrice` &lt;= 1900) AND (`sumFieldPrice` &lt;&gt; NULL)
  </code></pre>
  
  <p>I Have question how can I achieve NULL in this query
  I use it in having like this : (sumPriceField &lt;> NULL) but after that, there isn't any return value</p>
  
  <p>Is these query true? 
  can we use nested if in MySQL?</p>