A Database Error Occurred

Error Number: 1064

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 '` and d.gallery=g.section_id WHERE `g`.`section_left>2` and g.section_right<103 ' at line 3

SELECT `d`.`name` as img, `g`.* FROM (`projects_manage` g) LEFT OUTER JOIN `documents` d ON `d`.`type`='`gallery'` and d.gallery=g.section_id WHERE `g`.`section_left>2` and g.section_right<103 and g.active=1 GROUP BY `g`.`section_id` ORDER BY `g`.`order_` asc