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'

Recommended Answers

All 2 Replies

Hard to say without your table structures. Looks fine at first glance.

I think the issue is the || try this:

WHERE s.Companyname='tester' and st.state='karnataka'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.