select pro.*,cit.cityname,loc.locationname,(SELECT count( availStat ) FROM idb_p_availability WHERE prjId =pro.prjId
AND availstat = 'A' and IsActive = 1 ) as availcnt from idb_p_projects pro
inner join idb_city cit on pro.cityId=cit.cityId and cit.IsActive=1
inner join idb_location loc on pro.locationId=loc.locationId and loc.IsActive=1
where pro.IsActive=1 and pro.prjstatusId= and pro.cityid = 1 order by pro.prjId desc 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 pro.cityid = 1 order by pro.prjId desc' at line 5