title: Compare results of two mysql queries and get result in one query
body: <p>I've a situation. I've two tables <code>vehicles</code> and <code>job</code>. What I need is the list of vehicles which don't have a job. Means I need <code>vehicles</code> where vehicle id is not available in <code>job</code>.</p>
  
  <p>I tried:</p>
  
  <pre><code>SELECT v.id, v.registration_number
  FROM vehicles AS v
  LEFT JOIN job j ON j.vid = v.id
  WHERE v.uid = ?
  AND j.vid &lt;&gt; v.id
  AND TO_DAYS(j.home_day2) - TO_DAYS(NOW()) &lt;=11
  AND TO_DAYS(j.home_day2) - TO_DAYS(NOW()) &gt;=0
  ORDER BY v.id DESC
  </code></pre>
  
  <p>But this doesn't return any records even there's vehicles without job.</p>
  
  <p>Any help appreciated. Thanks.</p>
  
  <p>UPDATE:</p>
  
  <p>If anyone have the example where you could check whether the corresponding result is available in other table and exclude that result based on a condition.</p>