20 lines
428 B
SQL
20 lines
428 B
SQL
SELECT
|
|
SUM(s.quantity) AS subtotal,
|
|
s.itemFk,
|
|
s.concept,
|
|
i.subName,
|
|
i.tag5,
|
|
i.value5,
|
|
i.tag6,
|
|
i.value6,
|
|
i.tag7,
|
|
i.value7
|
|
FROM sale s
|
|
JOIN ticket t ON t.id = s.ticketFk
|
|
JOIN item i ON i.id = s.itemFk
|
|
JOIN itemType it ON it.id = i.typeFk
|
|
WHERE
|
|
t.clientFk = ? AND it.isPackaging = FALSE
|
|
AND DATE(t.shipped) BETWEEN ? AND ?
|
|
GROUP BY s.itemFk
|
|
ORDER BY i.typeFk , i.name |