You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-40' at line 1 [ SELECT `trenings`.*, `trenings_i18n`.`h1`, `trenings_i18n`.`title`, `trenings_i18n`.`keywords`, `trenings_i18n`.`description`, `trenings_i18n`.`name`, `trenings_i18n`.`time`, `treningsgroups_i18n`.`name` AS `group_name`, `treningsgroups`.`alias` AS `group_alias` FROM `trenings` LEFT JOIN `trenings_i18n` ON (`trenings_i18n`.`row_id` = `trenings`.`id`) LEFT JOIN `lessons` ON (`lessons`.`trening_id` = `trenings`.`id`) LEFT JOIN `treningsgroups` ON (`treningsgroups`.`id` = `trenings`.`parent_id`) LEFT JOIN `treningsgroups_i18n` ON (`treningsgroups_i18n`.`row_id` = `treningsgroups`.`id`) WHERE `trenings`.`status` = 1 AND `trenings`.`view_in_list` = 1 AND `trenings`.`created_at` <= 1500734410 AND `trenings_i18n`.`language` = 'ru' AND `lessons`.`status` = 1 AND `lessons`.`city_id` IS NOT NULL AND `lessons`.`date_from` >= 1500734410 AND `treningsgroups_i18n`.`language` = 'ru' GROUP BY `trenings`.`id` ORDER BY `lessons`.`created_at` DESC LIMIT 40 OFFSET -40 ]