title: Teradata CASE and COUNT syntax error
body: <p>Looking for how to write a CASE and COUNT query that will show total number of days on sale by item between dates 2/1/2017 - 4/19/2017.  I am receiving 'expected something between the word 'DATES' and the 'BETWEEN' keyword.</p>
  
  <p>Table 1:</p>
  
  <pre><code>ITEM    SALE    DATES
  Apple   Yes   4/19/2017
  Apple   Yes   2/18/2017
  Apple   Yes   1/17/2017
  Apple   no    3/16/2017
  Apple   no    4/17/2017
  Banana  Yes   4/19/2017
  Banana  Yes   2/18/2017
  Banana  Yes   1/17/2017
  Banana  Yes   3/16/2017
  Banana  no    4/17/2017
  </code></pre>
  
  <p>What I am looking for:</p>
  
  <pre><code>ITEM    Total days on sale
  Apple          2
  Banana         3
  </code></pre>
  
  <p>Current Query:</p>
  
  <pre><code>SELECT
      ITEM,
      CASE WHEN SALE='YES' THEN COUNT(DATES BETWEEN '2/1/2017' AND '4/19/2017') END AS TOTAL_DAYS_ON_SALE_DAYS
  FROM TABLE 1
  GROUP BY 
      ITEM
  ORDER BY 
      ITEM ASC
  </code></pre>