string(2464) "WITH picked AS ( SELECT product_class_id, MAX(schedule_num) AS mx FROM dtb_products_schedule WHERE schedule_id = 5 AND ? BETWEEN start_date AND finish_date AND sale_target IN (?) GROUP BY product_class_id ), sched_price AS ( SELECT s.product_class_id, s.price FROM dtb_products_schedule s JOIN picked p ON p.product_class_id = s.product_class_id AND p.mx = s.schedule_num )SELECT T3.* FROM ( SELECT DP.*, DPC.classcategory_id1, SUM(DPC.fav_count) AS fav_count, MAX(stock) AS max_stock, MIN(stock) AS min_stock, MAX(price01) AS max_price01, MIN(price01) AS min_price01, MAX(price02) AS max_price02, MIN(price02) AS min_price02, MAX(COALESCE(DPC.price, DPC.price02)) AS max_fix_price, MIN(COALESCE(DPC.price, DPC.price02)) AS min_fix_price, MAX(item_width) AS item_width, MAX(item_height) AS item_height, MAX(item_depth) AS item_depth FROM ( SELECT dtb_products.product_id, dtb_products.sort_rank, in_stock FROM dtb_products INNER JOIN ( SELECT dtb_product_categories.product_id FROM dtb_product_categories WHERE dtb_product_categories.category_id IN(?,?,?,?,?,?) GROUP BY dtb_product_categories.product_id ORDER BY NULL) AS T1 ON dtb_products.product_id = T1.product_id WHERE dtb_products.status IN (?) AND del_flg = 0 AND dtb_products.buy_flg = ? ORDER BY in_stock DESC, sort_rank DESC, product_id DESC LIMIT 48 OFFSET 8304) as DP INNER JOIN ( SELECT dtb_products_class.*,sp.price FROM dtb_products_class LEFT JOIN sched_price sp ON sp.product_class_id = dtb_products_class.product_class_id WHERE dtb_products_class.del_flg = 0 AND product_class_status = 1) as DPC ON DPC.product_id = DP.product_id GROUP BY DPC.product_id ORDER BY in_stock DESC, DP.sort_rank DESC, DP.product_id DESC LIMIT 48) as T3"