SELECT max(qo) AS des_qty,`product_id`,`parent_item_id`
FROM ( SELECT sum(`qty_ordered`) AS qo,`product_id`,created_at,store_id,`parent_item_id` FROM sales_flat_order_item GROUP BY `product_id` )
AS t1 where store_id
AND parent_item_id is null
AND created_at between '2019-08-6' AND '2020-08-05 15:59:20'
GROUP BY `product_id` ORDER BY des_qty DESC LIMIT 6