Time : 12:52:50 SQLSTATE[42000]: Syntax error or access violation: 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 ') order by NAME asc' at line 1 Raw SQL : select count(PARTYID) as totalnew_parties from partydetail as p,(select PARTY,CITY,STATE from contact) as c where p.PARTYID=c.PARTY and NAME!='' and ISACTIVE=1 and BUSINESSTYPE=15) order by NAME asc Time : 08:11:00 SQLSTATE[42000]: Syntax error or access violation: 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 '' at line 1 Raw SQL : select ipaddress from p_customers where customerid=