Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT customer_id,
- invoice_date,
- total,
- DATE_TRUNC('month', CAST(invoice_date AS TIMESTAMP)),
- EXTRACT(WEEK FROM CAST(invoice_date AS TIMESTAMP))
- FROM invoice
- WHERE customer_id BETWEEN 20 AND 50
- AND EXTRACT(WEEK FROM CAST(invoice_date AS TIMESTAMP)) IN (5, 7, 10, 33, 48);
Advertisement
Comments
-
- Отфильтруйте получившуюся таблицу по номерам недели. Оставьте в таблице данные за 5, 7, 10, 33 и 48 недели.
Add Comment
Please, Sign In to add comment
Advertisement