Time : 15:26:17 SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.fromDate' in 'where clause' Raw SQL : select distinct p.NAME,p.PARTYCODE,c.ADD1,c.ADD2,c.ADD3,concat(ifnull(c.add2,''),' ',ifnull(c.add3,'')) add2,csc.CODE,csc.NAME cityname,country.NAME countryname,cstate.NAME statename,cstate.shortname,district.NAME districtname,country.name country,c.PINCODE,concat(c.STDCODE,c.PHONE) PHONE,person.NAME cpname,ifnull(person.MOBILENO,c.mobile) MOBILENO ,min(person.CONTACTPERSONID),p.partyid, ms.VALUE as cpgreeting,mspg.VALUE as partygreeting from partydetail p left outer join contactperson person on person.PARTY = p.PARTYID left outer join dealsin dl on dl.PARTY=p.PARTYID left outer join master ms on ms.MASTERID=person.greeting left outer join master mspg on mspg.MASTERID=p.GREETING left outer join contact c on p.PARTYID = c.PARTY left outer join countrystatecity csc on c.CITY = csc.COUNTRYSTATECITYID left outer join countrystatecity cstate on c.state =cstate.countrystatecityid left outer join countrystatecity district on csc.PARENTID = district.COUNTRYSTATECITYID left outer join countrystatecity country ON cstate.PARENTID =country.COUNTRYSTATECITYID left outer join ( select sub.PARTY partyid from partydetail p inner join subscription sub on sub.PARTY = p.PARTYID inner join magzinedetail m on m.MAGZINEDETAILID = ifnull(sub.MAGZINENAME,1) inner join magzineeditions me on m.MAGZINEDETAILID = me.MAGZINEDETAIL where 1=1 and sub.mgznpostbyid=1 and ifnull(iscancel,0) =0 and me.MAGZINEEDITIONSID = 168 and s.fromDate <= me.DATEOFEDITIONS and ifnull(s.toDate,me.DATEOFEDITIONS) >= me.DATEOFEDITIONS and (iscontinue = 1 or ifnull(s.isEom,me.isEom) = me.isEom) group by sub.SUBSCRIPTIONID ) a on p.PARTYID = a.partyid left outer join ( select ad.PARTY partyid from magzinedetail m inner join magzineeditions me on m.MAGZINEDETAILID = me.MAGZINEDETAIL inner join suborders s on s.MAGZINEEDITIONS = me.MAGZINEEDITIONSID inner join advertisementbooking ad on ad.ADVERTISEMENTBOOKINGID = s.ADVERTISEBOOKINGID where 1=1 and ad.mgznpostbyid=1 and s.ISCANCEL is null and s.MAGZINEEDITIONS= '168' group by ad.party ) ad on ad.partyid = p.PARTYID where 1=1 and c.addresstype=350 and ifnull(a.partyid,ifnull(ad.partyid,0)) != 0 and c.addresstype=350 group by p.partyid order by cstate.CODE,district.CODE,csc.CODE asc Time : 15:25:05 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 'and ifnull(iscancel,0) =0 and me.MAGZINEEDITIONSID = 168 and s.fromDate <= me.DA' at line 18 Raw SQL : select distinct p.NAME,p.PARTYCODE,c.ADD1,c.ADD2,c.ADD3,concat(ifnull(c.add2,''),' ',ifnull(c.add3,'')) add2,csc.CODE,csc.NAME cityname,country.NAME countryname,cstate.NAME statename,cstate.shortname,district.NAME districtname,country.name country,c.PINCODE,concat(c.STDCODE,c.PHONE) PHONE,person.NAME cpname,ifnull(person.MOBILENO,c.mobile) MOBILENO ,min(person.CONTACTPERSONID),p.partyid, ms.VALUE as cpgreeting,mspg.VALUE as partygreeting from partydetail p left outer join contactperson person on person.PARTY = p.PARTYID left outer join dealsin dl on dl.PARTY=p.PARTYID left outer join master ms on ms.MASTERID=person.greeting left outer join master mspg on mspg.MASTERID=p.GREETING left outer join contact c on p.PARTYID = c.PARTY left outer join countrystatecity csc on c.CITY = csc.COUNTRYSTATECITYID left outer join countrystatecity cstate on c.state =cstate.countrystatecityid left outer join countrystatecity district on csc.PARENTID = district.COUNTRYSTATECITYID left outer join countrystatecity country ON cstate.PARENTID =country.COUNTRYSTATECITYID left outer join ( select sub.PARTY partyid from partydetail p inner join subscription sub on sub.PARTY = p.PARTYID inner join magzinedetail m on m.MAGZINEDETAILID = ifnull(sub.MAGZINENAME,1) inner join magzineeditions me on m.MAGZINEDETAILID = me.MAGZINEDETAIL where 1=1 and sub.mgznpostbyid=1 and and ifnull(iscancel,0) =0 and me.MAGZINEEDITIONSID = 168 and s.fromDate <= me.DATEOFEDITIONS and ifnull(s.toDate,me.DATEOFEDITIONS) >= me.DATEOFEDITIONS and (iscontinue = 1 or ifnull(s.isEom,me.isEom) = me.isEom) group by sub.SUBSCRIPTIONID ) a on p.PARTYID = a.partyid left outer join ( select ad.PARTY partyid from magzinedetail m inner join magzineeditions me on m.MAGZINEDETAILID = me.MAGZINEDETAIL inner join suborders s on s.MAGZINEEDITIONS = me.MAGZINEEDITIONSID inner join advertisementbooking ad on ad.ADVERTISEMENTBOOKINGID = s.ADVERTISEBOOKINGID where 1=1 and ad.mgznpostbyid=1 and s.ISCANCEL is null and s.MAGZINEEDITIONS= '168' group by ad.party ) ad on ad.partyid = p.PARTYID where 1=1 and c.addresstype=350 and ifnull(a.partyid,ifnull(ad.partyid,0)) != 0 and c.addresstype=350 group by p.partyid order by cstate.CODE,district.CODE,csc.CODE asc Time : 10:45:45 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 productId,productName from product where category=