Time : 07:32:29 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 'in (351,350) group by inv.INVOICEDETAILID order by inv.REFERENCENO asc' at line 15 Raw SQL : select inv.invoicefromdate,inv.invoicetodate,inv.ADJUSTMENTDATE,inv.REFERENCENO,p.NAME,csc.NAME as cityname,ps.PAGENAME,sum(subordr.netamount) totalnetamount, inv.adjustmentamount, inv.cgstAmount,inv.sgstAmount,inv.igstAmount,inv.totalGstAmount,roundOffAmount ,sub.DUMMYPAGENO from invoicedetail inv inner join suborders sub on inv.suborder = sub.SUBORDERSID inner join magzineeditions m on sub.MAGZINEEDITIONS = m.MAGZINEEDITIONSID inner join advertisementbooking ad on sub.ADVERTISEBOOKINGID = ad.ADVERTISEMENTBOOKINGID inner join suborders subordr on subordr.ADVERTISEBOOKINGID = ad.ADVERTISEMENTBOOKINGID and subordr.BILLTOBEGENERATEDEDITIONS = m.MAGZINEEDITIONSID inner join partydetail p on p.PARTYID=ad.PARTY inner join contact co on co.PARTY=p.PARTYID inner join countrystatecity csc on csc.COUNTRYSTATECITYID=co.CITY inner join tarrifdetail tf on tf.ID=sub.TARRIF inner join pagesizes ps on ps.ID=tf.PAGESIZE where m.MAGZINEEDITIONSID=167 and ifnull(sub.iscancel,0)=0 and sub.BILLSTATUS='Bill Generated' and co.addresstype = in (351,350) group by inv.INVOICEDETAILID order by inv.REFERENCENO asc