salix/print/templates/reports/cmr/sql/merchandise.sql

11 lines
339 B
MySQL
Raw Normal View History

2023-08-02 05:35:40 +00:00
SELECT s.ticketFk,
ic.name,
CAST(SUM(sv.weight) AS DECIMAL(10,2)) `weight`,
CAST(SUM(sv.volume) AS DECIMAL(10,3)) volume
FROM sale s
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
WHERE sv.ticketFk = ?
GROUP BY ic.id