报表xx(提问者)SELECT A.F_Stort_Date,A.factoryname,A.industryname,B.f_stort_type_name,A.投分选量,A.废弃烟叶量,A.废弃烟末量,A.一类杂物量,A.二三类杂物 FROM
(select F_Stort_Date,factoryname,industryname,f_stort_type_id,
sum(f_stort_weight) as 投分选量,
sum(f_Waste_Weight) as 废弃烟叶量,
sum(F_Waste_YM) as 废弃烟末量,
sum(F_Clutter_1) as 一类杂物量,
sum(F_Clutter_23) as 二三类杂物
FROM (SELECT a.* FROM View_Stort_Fill a INNER JOIN
(SELECT max(lock_time ) lock_time FROM View_Stort_Fill ) b ON a.lock_time=b.lock_time)
WHERE F_Stort_Date BETWEEN \'2021-06-27\' AND \'2021-08-01\' AND factoryname=\'保山复烤厂\'
group by F_Stort_Date,factoryname,industryname,f_stort_type_id ORDER BY F_Stort_Date) A
LEFT JOIN
(SELECT f_stort_type_name,f_stort_type_id FROM v_fill_stort_plan) B
ON A.f_stort_type_id=B.f_stort_type_id