title: In PostgreSQL, how do you insert date you've extracted into a query?
body: <p>So i am supposed to find purchases made by customers holding visa credit card on New Year's Day. The table has a datetime field; I can extract the date  from it but how do I have it in the WHERE Clause?</p>
  <pre><code>SELECT cs.name , DATE(t.datetime) AS new_year
  FROM customers cs, credit_cards cc, transactions t
  WHERE t.number = cc.number
  AND cc.type ='visa'
  AND t.amount NOTNULL 
  AND new_year = '2019-01-01';
  </code></pre>
  <p>above query shows type(new_year) does not exist</p>