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 '1 GROUP BY `aic_property`.`property_ID` ORDER BY `aic_property`.`SortOrder` AS' at line 14
SELECT `aic_property`.*,DATE_FORMAT(property_OpenHouseDate, '%M' ) as month, COALESCE(`aic_photo`.`photo_File`, '/images/house_sil.gif') as photo_File, COALESCE(`aic_photo`.`photo_Homebig`, '/images/house_sil.gif') as photo_Homebig, COALESCE(`aic_photo`.`photo_Thumb`, '/images/house_sil.gif') as photo_Thumb, `aic_photo`.`photo_Title`, `aic_photo`.`photo_Alt` FROM `aic_property` LEFT JOIN `aic_photo` ON `aic_photo`.`photo_PropertyID` = `aic_property`.`property_ID` AND `aic_photo`.`SortOrder` <= 1 WHERE `property_StatusID` in (1,3,2,5,6) AND `property_ListPrice` > 0 1 GROUP BY `aic_property`.`property_ID` ORDER BY `aic_property`.`SortOrder` ASC LIMIT 0, 5