我希望此代码仅显示$user_id的朋友的结果,但我想显示来自朋友和$user_id的结果
SELECT *
FROM
activity,
friends
WHERE
friends.user_id='$user_id'
and activity.activity_user=friends.fr_id
ORDER BY activity.id DESC
LIMIT 10
使用加入
SELECT
t1.*
FROM
activity as t1
join friends on t1.activity_user=friends.fr_id
WHERE
friends.user_id='$user_id'
ORDER BY t1.id DESC
LIMIT 10