Второй запрос про поставки заготовок

This commit is contained in:
Anton Kamalov
2024-10-24 12:55:01 +03:00
parent 48ec45708a
commit 54e0091687
6 changed files with 78 additions and 17 deletions

View File

@@ -1,3 +1,4 @@
SELECT weight, price, count, last_update
SELECT weight AS 'Вес', price AS 'Цена',
count AS 'Количество', last_update AS 'Дата последнего обновления'
FROM workpiece
WHERE material = '${material}'

View File

@@ -0,0 +1,10 @@
SELECT sellers.name AS 'Поставщик',
w.date_of_delivery AS 'Дата поставки',
SUM(wl.count) AS 'Общее количество заготовок',
SUM(wl.price) AS 'Общая стоимость поставленных заготовок'
FROM waybill w
JOIN waybill_lines wl ON w.waybill_id = wl.waybill_id
JOIN workpiece USING(work_id)
JOIN sellers USING(sel_id)
WHERE workpiece.material = '${material}'
GROUP BY sellers.name, w.date_of_delivery;