大家好,我正在使用 MySQL 和 PHP 制作关注者/被关注系统,所以我想获取我关注的用户的所有视频并按 ID 描述排序。
例如,如果我的 user_id = 1
,并且如果我正在关注 user_id = 3 的用户; 5;
我只想查看来自 publisher_id = 3; 的视频5;
最佳答案
使用 join
将表格链接在一起,然后使用 where
将视频限制为仅限您的关注者。
select *
from user_followers as uf
join videos as v
on uf.followed_id = v.publisher_id
where uf.follower_id = ?
Generally, the
ON
clause serves for conditions that specify how to join tables, and theWHERE
clause restricts which rows to include in the result set.
关于php - MySql 查询 "Following/Follower"系统,[PHP],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44027144/