我正在尝试让每个工厂根据count(*)来显示前10行,我能够拉出总的前10行,但我正在努力按工厂获得它。我从中提取的表格有50,000多个结果。
select concat(designid,productid), plantname, salesorder, so_line,
designid, productid, '40', datetofunction,
CURDATE() + INTERVAL 7 DAY,
stylenumber, customer, count(*)
from packages
where concat(designid,productid) is not null
and pdm_complete >= CURDATE() - INTERVAL 9 MONTH
group by concat(designid,productid)
order by count(*) desc
limit 10)