Код: Выделить всё
SELECT `t`.`id` AS `t0_c0`, `t`.`cat_id` AS `t0_c3`, `t`.`type_id` AS `t0_c19`, `t`.`title` AS `t0_c1`, `t`.`slug` AS `t0_c2`, `t`.`content_short` AS `t0_c4`, `t`.`create_time` AS `t0_c6`, `category`.`id` AS `t1_c0`, `category`.`title` AS `t1_c1`, `category`.`slug` AS `t1_c2`, `type`.`title` AS `t2_c1`, `type`.`slug` AS `t2_c12`, `type`.`column_placement` AS `t2_c17`, `type`.`id` AS `t2_c0` FROM `items` `t` LEFT JOIN items f2 ON (t.type_id = f2.type_id AND t.create_time >= f2.create_time) LEFT OUTER JOIN `category` `category` ON (`t`.`cat_id`=`category`.`id`) LEFT OUTER JOIN `type` `type` ON (`t`.`type_id`=`type`.`id`) GROUP BY t.type_id, t.create_time HAVING (COUNT(*) <= 5)
Время: 35796.9 ms