select
o.date,
p.ss_created,
p.ss_name,
sku,
ss_sku,
p.ss_price,
p.ss_searchkeywords,
p.ss_productfield1,
p.ss_productfield2,
p.ss_productfield3,
p.ss_productfield4,
p.ss_productfield5,
p.ss_productfield6,
p.ss_productfield7,
p.ss_productfield8,
p.ss_productfield10,
p.ss_productfield11,
p.ss_productfield12,
p.ss_productfield13,
p.ss_productfield14,
p.ss_productfield15,
p.ss_productfield16,
p.ss_productfield17,
p.ss_productfield18,
p.ss_productfield19,
p.ss_productfield31,
ss_productdescription,
ss_moreinfotext,
ss_QuantityOnHand,
ss_brand,
count(o.sku) as c
from
ss_products p
LEFT JOIN
ss_orders o ON o.sku = p.ss_sku where p.ss_productfield4 != '' and p.ss_productfield6 != '' and p.ss_productfield12 not REGEXP '(DSC|Web|INFO|AMZ)' and p.ss_productfield3 = 'unchecked' and p.ss_name REGEXP 'Orrefors'
and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= o.date
group by p.ss_sku order by c desc limit 1
https://d3l97e4uq59tzn.cloudfront.net/images/1200/6490833/6490833_a1.jpg