View difference between Paste ID: uzte4p8G and S6tLypH4
SHOW: | | - or go back to the newest paste.
1
SELECT customer_id,
2
       invoice_date,
3
       total,
4
       DATE_TRUNC('month', CAST(invoice_date AS timestamp)),
5
       EXTRACT(WEEK FROM CAST(invoice_date AS timestamp))
6
FROM invoice
7-
WHERE(customer_id BETWEEN 20 AND 50);
7+
WHERE customer_id BETWEEN 20 AND 50
8
AND EXTRACT(WEEK FROM CAST(invoice_date AS timestamp)) IN (5, 7, 10, 33, 48);