SELECT TOP 10 sum(CoalPowderHeat/7000*(CoalPowderlConsumption+coalPowderlConsumptionModify)) as coal
FROM dbo.
LEFT JOIN PL_SITE ON MonthReport.factoryKey = PL_SITE.OBJECT_KEY
LEFT JOIN PL_CELL ON MonthReport.prodLineKey = PL_CELL.DCS_NUMBER
WHERE convert(varchar(7),ReportDate,23)= '${left(MONTHDELTA(TODAY(), -1),7)}'
GROUP BY
PL_CELL.CELL_NUMBER order by coal我现在想取coal最小的10条产线(PL_CELL.CELL_NUMBER)的数据,问题是:有的工厂(PL_SITE.SITE_NUMBER)有一条产线,有的是两条;对于是两条的工厂,只取coal小的那条产线数据即可。