MaximPixel

Untitled

Jul 1st, 2022 (edited)
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.60 KB | None | 0 0
  1. // OLD
  2. select `prods`.*, `cat_prod`.`cat_id` as `pivot_cat_id`, `cat_prod`.`prod_id` as `pivot_prod_id` from `prods` inner join `cat_prod` on `prods`.`id` = `cat_prod`.`prod_id` where `cat_prod`.`cat_id` = 55 and `enabled` = 1 order by `onmarket` desc, `priority` desc limit 25 offset 49975;
  3.  
  4. // NEW
  5. select `prods`.*, `cat_prod`.`cat_id` as `pivot_cat_id`, `cat_prod`.`prod_id` as `pivot_prod_id` from (select * from `prods` where `enabled` = 1 order by `onmarket` desc, `priority` desc) prods inner join `cat_prod` on `prods`.`id` = `cat_prod`.`prod_id` where `cat_prod`.`cat_id` = 55 limit 25 offset 49975
Add Comment
Please, Sign In to add comment