title: How to Apply Conditional Logic to Where Statement
body: <p>I can't seem to figure out how to set the logic up for my particular problem. I'm trying to count the number of times the word "Service" appears but only when the RECORD_CODE is INCIDENT. When the RECORD is INCIDENT-UPDATE, it is normally already somewhere else as an INCIDENT so I exclude them to keep from duplicating my data.</p>
  
  <p>However, there are a small number of cases where the SUBMIT_METHOD is "WEB" and the only record is an INCIDENT_UPDATE and I cannot figure out how to look only where the RECORD = 'INCIDENT' unless the particular record has a SUBMIT_METHOD of "WEB" and there is no record for that report # with a RECORD of INCIDENT. It could be a simple problem and I'm just overthinking it but I cannot think of how to do it. Any help would be GREATLY appreciated!</p>
  
  <p>My query:</p>
  
  <pre><code>        SELECT column2, count(*) as 'COUNT'
          from Service.Table
          where date between '1/1/17' and '1/31/17'
          and column1 = 'Issue'
          and RECORD = 'INCIDENT'
          group by column2
  </code></pre>
  
  <p>Sample of the data:</p>
  
  <pre><code>REPORT #    RECORD    SUBMIT_METHOD   SUBMIT_DATE   COLUMN2
  1234       Incident       Web          1/1/2017     Service
  1234    Incident-Update   Web          1/1/2017     Service
  1235       Incident      Phone        1/15/2017      Other
  1235    Incident-Update  Phone        1/15/2017      Other
  1236    Incident-Update   Web         1/18/2017     Service
  </code></pre>
  
  <p>The expected output in this case would be:</p>
  
  <pre><code>COLUMN2   COUNT
  Service     3
  </code></pre>
  
  <p>If I can provide any other info just let me know!</p>