I have two tables in my SQL, 'post' and 'business' The columns in the post are:
The columns in business are
What I want is I want the posts which are posted by businesses with high business rating come first before others, please is there a way to fetch the posts with order of business rating???
To order results of posts with associated business rating you need a join query
select p.*
from posts as p
join business as b on b.business_id = p.business_id
order by b.business_rating desc
order by
查询排列评级使用order by
select * from posts,business order by business_rating where posts.business_ID=business.business_ID;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.