Devises
This commit is contained in:
@@ -29,3 +29,18 @@ join 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;
|
||||
|
||||
/*
|
||||
INSERT INTO prix_historique (article_code, prix_unitaire, dates)
|
||||
SELECT
|
||||
article_code,
|
||||
prix_unitaire,
|
||||
daterange(
|
||||
date(MIN(t.date_ticket)),
|
||||
date(LEAD(MIN(t.date_ticket)) OVER (PARTITION BY article_code ORDER BY MIN(t.date_ticket)))
|
||||
) AS dates
|
||||
FROM ligne l
|
||||
JOIN ticket t ON t.id = l.ticket_id
|
||||
GROUP BY article_code, prix_unitaire
|
||||
ORDER BY article_code, MIN(t.date_ticket);
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user