This commit is contained in:
2025-11-02 07:35:49 +01:00
parent 77340d2cf6
commit 46939c265c
9 changed files with 183 additions and 145 deletions

View File

@@ -5,7 +5,7 @@ create view nb_total_articles as
select count(*) as nb_total_articles from article;
create view nb_total_tickets as
select count(*) as nb_total_tickets from ticket;
select count(*) as nb_total_tickets from market.ticket;
create view nb_total_adherents as
select count(*) as nb_total_adherents from adherent;
@@ -14,8 +14,8 @@ create materialized view detail_ticket as
select t.id as ticket_id, t.date_ticket, t.mode_rglt,
h.id as adherent_id, h.codepostal, h.genre,
round(sum(l.total), 2) as total
from ticket t
join ligne l on l.ticket_id = t.id
from market.ticket t
join market.ligne l on l.ticket_id = t.id
join adherent h on h.id = t.adherent_id
group by t.id, h.id;
@@ -24,8 +24,8 @@ select t.id as ticket_id, t.date_ticket, t.mode_rglt,
h.id as adherent_id, h.codepostal, h.genre,
l.article_code, a.famille_code,
round(sum(l.total), 2) as total
from ticket t
join ligne l on l.ticket_id = t.id
from market.ticket t
join market.ligne l on l.ticket_id = t.id
join adherent h on h.id = t.adherent_id
join article a on a.code = l.article_code
group by t.id, h.id, l.article_code, a.famille_code;