A Database Error Occurred

Error Number: 1064

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 `categoryid` = 0 ) a GROUP BY a.`id` ORDER BY...' at line 12

SELECT a.* from (select distinct warbleen_crm.act.*, warbleen_crm.act_profilephoto.path, warbleen_crm.county.county AS location/*, (select count(*) from warbleen_crm.enquiry_act_booked join warbleen_crm.enquiry on enquiry.id = warbleen_crm.enquiry_act_booked.enquiry_id where act_id = warbleen_crm.act.id and warbleen_crm.enquiry_act_booked.date_booked > DATE_SUB(NOW(), INTERVAL 6 MONTH) AND warbleen_crm.enquiry_act_booked.date_booked < DATE_ADD(NOW(), INTERVAL 6 MONTH)) as count*/ FROM (`warbleen_front`.`act_category`) JOIN `warbleen_crm`.`act` ON `warbleen_crm`.`act`.`id` = `warbleen_front`.`act_category`.`actid` AND `active` = 1 LEFT JOIN `warbleen_crm`.`act_profilephoto` ON `warbleen_crm`.`act_profilephoto`.`act_id` = `warbleen_crm`.`act`.`id` LEFT JOIN `warbleen_crm`.`county` ON `warbleen_crm`.`county`.`id` = `warbleen_crm`.`act`.`act_location` RIGHT JOIN `warbleen_crm`.`act_price` ON `warbleen_crm`.`act_price`.`act_id` = `warbleen_crm`.`act`.`id` LEFT JOIN `warbleen_crm`.`enquiry_act_booked` ON `warbleen_crm`.`enquiry_act_booked`.`act_id` = `warbleen_crm`.`act`.`id` WHERE ( 1 = 1 AND ) AND `categoryid` = 0 ) a GROUP BY a.`id` ORDER BY a.`bookings` desc, a.id DESC

Filename: models/Act_model.php

Line Number: 256