0

I am trying to get each plant to display the top 10 lines based on the count(*) I am able to pull the overall top 10 but getting it by plant is where I am struggling. The table I am pulling from has over 50,000 results.

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)
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
AC130
  • 35
  • 5

0 Answers0