0

i want to display first priority wise after that remaining data if no priority will display all data by

select DISTINCT s.Companyname,s.id as companyid,s.LogoImage,s.LogoPath,s.Url,ck.MainCatagory,c.city,st.state,sub.Subcatagory,sub.MainCatid,p.priority,rc.RelatedCatagory 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 cities c on c.city_id=cp.city_id 
left join states st on st.state_id=c.state_id
left join priority p on p.company_id=s.id
WHERE s.Publish=1 AND rc.mainCatagoryid='$maincatid' AND ck.MainCatagory='$maincateg' GROUP BY s.Companyname ORDER BY p.priority DESC LIMIT 5
Attachments ree.png 5.52 KB reee.png 19.06 KB
2
Contributors
2
Replies
17
Views
3 Years
Discussion Span
Last Post by malatamil
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.