title: Another select statement if the value is NULL
body: <p>I want to send completely another query if the value of the given field is NULL is it possible ? </p>
  
  <p>Something like this : </p>
  
  <pre><code>   IF the value is null 
        SELECT * FROM `locations`
     ELSE 
        SELECT * FROM `companies`
     ENDIF
  </code></pre>
  
  <p>I want to use the output of this query in another query. So it is going to be like this. If the field is not null in the first table take it else take another field from another table and lastly another query from the result of this if. </p>