title: How to check Query is null inside IF condition?
body: <p>I want to check query inside the condition</p>
  
  <p>I want the value 'NO' if query is null and 'YES' if query is not null</p>
  
  <p>by trying in if condition I get error. </p>
  
  <p>My query is</p>
  
  <pre><code>SELECT Count(SiteID)
  from ChartFace 
  Inner Join Structure on Structure.StructureID = ChartFace.StructureID
  where (ContractNumber='C197960' AND LineNumber=4) 
    AND (ISNULL('MN420628', '-1')='-1' or SiteID = 'MN420628')
  </code></pre>
  
  <p>What I tried </p>
  
  <pre><code>IF(above query is NULL) THEN 'NO'
  ELSE 'YES'
  END IF
  </code></pre>
  
  <p>Later I need this in my select statement</p>
  
  <pre><code>Select ContractID, ContractName, IF(above query is NULL) THEN 'NO'
  ELSE 'YES' AS Status FROM Contract 
  </code></pre>
  
  <p>How can I do this?</p>