for pagination i need to display number of data.here is my query but am getting error like
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 'st.state)as num from spa s left join relatedcatagories rc on rc.spaid=s.id le' at line 1
select count(DISTINCT s.Companyname,s.id,ck.MainCatagory,c.city,st.state,cp.state_id) from spa s
left join relatedcatagories rc on rc.spaid=s.id
left join catagorykeywords ck on ck.id=rc.mainCatagoryid
left join subcatagorykeywords sub on sub.id=rc.RelatedCatagory
left join city_place cp on cp.spaid=s.id
left join states st on st.state_id=cp.state_id
left join cities c on c.city_id=cp.city_id
WHERE s.Companyname='tester' || st.state='karnataka'