Advertisement
Step8rother

Операторы и функции для работы с датой и временем, задача 3

Jun 23rd, 2023 (edited)
792
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.30 KB | Source Code | 0 0
  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
  8. AND EXTRACT(WEEK FROM CAST(invoice_date AS TIMESTAMP)) IN (5, 7, 10, 33, 48);
Advertisement
Comments
  • Step8rother
    1 year
    # text 0.18 KB | 0 0
    1. Отфильтруйте получившуюся таблицу по номерам недели. Оставьте в таблице данные за 5, 7, 10, 33 и 48 недели.
Add Comment
Please, Sign In to add comment
Advertisement