Advertisement
t7235
Oct 29th, 2023
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. либо немного изменить
  2.  
  3. SELECT EXTRACT(YEAR FROM CAST(i.invoice_date AS DATE)) AS year_of_invoice,
  4. COUNT(DISTINCT t.name) AS unique_track_count
  5. FROM invoice AS i
  6. LEFT JOIN invoice_line AS il ON i.invoice_id = il.invoice_id
  7. LEFT JOIN track AS t ON il.track_id = t.track_id
  8. GROUP BY year_of_invoice;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement