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