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 | |
---|
1 | CREATE VIEW rank_list_most_active_customers_view AS
|
---|
2 | SELECT
|
---|
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
|
---|
6 | from customer c
|
---|
7 | LEFT JOIN invoice i on c.customer_id = i.customer_id
|
---|
8 | GROUP BY c.first_name, c.last_name
|
---|
9 | order by total_money_spent desc |
---|
Note:
See
TracBrowser
for help on using the repository browser.