SELECT 
    DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки', 
    TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки', 
    s.name AS 'Поставщик', 
    wl.amount AS 'Количество' 
FROM waybill w 

JOIN (SELECT waybill_id, work_id, amount FROM waybill_lines) wl USING(waybill_id)
JOIN (SELECT user_id, sel_id FROM external_users) eu USING(user_id)
JOIN (SELECT sel_id, name FROM sellers) s USING(sel_id)
WHERE work_id = '$workpiece'
GROUP BY waybill_date, name;