SELECT w.name AS Наименование, 
    reports.sum AS 'Сумма (в ₽)', 
    reports.count AS 'Количество поставленных заготовок (в шт.)'
    from reports
JOIN workpiece w ON reports.item_id = w.work_id
WHERE report_category_id = '$id' AND (month = '$month' AND year = '$year')
GROUP BY w.material, w.name
ORDER BY w.name;