I am trying to SQL query (not Magento collection) to get at most 5 products day-wise which lie under my SQL date comparison check .

   $sql = "SELECT `*` FROM `sales_bestsellers_aggregated_daily` AS `s` 
            INNER JOIN `catalog_product_entity` AS `c` 
            WHERE `s`.`product_id` = `c`.`entity_id` AND  
              (`s`.`period` >= '19-10-27' AND `s`.`period` <= '19-11-06' ) 
              AND `s`.`store_id`=1";

This gives me all the products that lie between 19-10-27 and 19-11-06. but I want to use a limit of 5 for each date.

i.e, for 19-10-27 number of products, should be 1 to 5 (not all)

  • its preferred to ask this question on stack overflow – Waqar Ali Nov 7 '19 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.