You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND work_orders.id <> 24145 GROUP BY work_orders.id ' at line 59 [ SELECT work_orders.id, work_orders.title, work_orders.description, work_orders.price, work_orders.deadline, work_orders.created, work_orders.updated, work_orders.vip_catalog, work_categories.title AS work_type, work_categories.category_image AS work_image_class, subject.id AS subject_id, subject.title AS subject_name, subject.parent_id AS discipline_id, rating_statuses.icon AS status_icon, rating_statuses.title AS status_title, roles_users.role_id AS vip_customer, COUNT(bids.id) AS bids_count, MIN(bids.price) AS min_bid, MAX(bids.price) AS max_bid, user_bid.price AS user_bid, user_bid.id AS user_bid_id, users.username AS user_name, users.id AS user_id, users.rating_customer AS user_rating, users.avatar AS user_avatar FROM work_orders LEFT JOIN users ON (users.id = work_orders.user_id) LEFT JOIN rating_statuses ON (rating_statuses.user_type = 1 AND rating_statuses.points_from <= users.rating_customer AND ( rating_statuses.points_to >= users.rating_customer OR rating_statuses.points_to = 0 OR rating_statuses.points_to = '' OR rating_statuses.points_to IS NULL )) LEFT JOIN field_data_worktype ON (field_data_worktype.entity_id = work_orders.id) LEFT JOIN work_categories ON (work_categories.id = field_data_worktype.value) LEFT JOIN field_data_science_branch ON (field_data_science_branch.entity_id = work_orders.id) LEFT JOIN taxonomy_terms AS subject ON (subject.id = field_data_science_branch.value) LEFT JOIN bids ON (bids.target_model = 'workorder' AND bids.target_id = work_orders.id) LEFT JOIN bids AS user_bid ON (user_bid.target_model = 'workorder' AND user_bid.target_id = work_orders.id ) LEFT JOIN roles_users ON (roles_users.user_id = work_orders.user_id AND roles_users.role_id = 5) LEFT JOIN authors_workorders ON (authors_workorders.workorder_id = work_orders.id) WHERE work_orders.is_deleted = 0 AND work_orders.status = 10 AND work_orders.author_id IS NULL AND field_data_science_branch.entity_fieldinstance_id = 174 AND field_data_worktype.entity_fieldinstance_id = 80 AND subject.vocabulary_id = 1 AND ( authors_workorders.author_id = null OR authors_workorders.author_id IS NULL ) AND subject.id IN (545,583,584,587,588,589,590,591,592,593,594,595,582,581,575,546,548,549,550,551,552,554,555,556,571,572,596,598,599,606,585,586,604,603,602,601,600,553,537,124,538,543,540,542,125,517,457,458,127,506,130,132,137,510,140,142,145,148,151,152,460,156,158,160,529,514,162,505,163,461,462,165,464,463,166,167,168,169,170,171,173,175,177,179,465,181,184,466,185,525,513,531,532,192,195,197,199,201,467,204,206,208,512,210,212,214,217,468,219,221,524,224,226,228,230,504,232,234,236,238,240,469,511,188,470,527,530,507,243,245,247,518,528,249,503,250,471,251,186,473,252,523,533,474,253,475,254,476,255,256,526,259) AND field_data_science_branch.value IN (510) AND field_data_worktype.value IN () AND work_orders.id <> 24145 GROUP BY work_orders.id ORDER BY IF (work_orders.vip_catalog,1,0) DESC, work_orders.created DESC LIMIT 0, 5 ]/home/web/professor.by/www/modules/database/classes/Kohana/Database/MySQL.php:194