11 lines
339 B
MySQL
11 lines
339 B
MySQL
|
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
|