我的查询如下:
SELECT
*
FROM
ajee_friends
JOIN
ajee_wall
ON
ajee_friends.fid = ajee_wall.uid
WHERE
ajee_friends.uid = '$this->uid'
答案 0 :(得分:5)
如果你想要你朋友的墙和你自己的墙,这可以做到(在我看来更可读作为subselect):
SELECT *
FROM ajee_wall w
WHERE w.uid IN (SELECT fid FROM ajee_friends WHERE uid = $this->uid)
OR w.uid = $this->uid
答案 1 :(得分:2)
SELECT *
FROM ajee_wall w
WHERE w.uid IN
( SELECT fid
FROM ajee_friends
WHERE uid = $this->uid
)
UNION ALL
SELECT *
FROM ajee_wall w
WHERE w.uid = $this->uid
答案 2 :(得分:0)
我认为你可以使用Union all ... 像,
SELECT * FROM ajee_friends UNION ALL SELECT * FROM ajee_wall
它会显示你所有的帖子和你的朋友。你可以让它只显示几行限制。