source: music/views/rang_list_most_active_customers_view.sql

Last change on this file was 0e077ef, checked in by ManuelTrajcev <manueltrajcev7@…>, 6 weeks ago

2 views wtih controllers and templates added

  • Property mode set to 100644
File size: 322 bytes
Line 
1CREATE VIEW rank_list_most_active_customers_view AS
2SELECT
3 c.first_name || ' ' || c.last_name as name,
4 COUNT(i.invoice_id) as total_orders,
5 SUM(i.total) as total_money_spent
6from customer c
7LEFT JOIN invoice i on c.customer_id = i.customer_id
8GROUP BY c.first_name, c.last_name
9order by total_money_spent desc
Note: See TracBrowser for help on using the repository browser.