PHP MySQL 查询 JOIN HELP
嘿大家。所以,我正在为我的一个项目创建这种社交网络脚本,我需要它来显示类似于 Facebook 提要的新闻提要,即显示您朋友的帖子和您自己的帖子......但是用我的技术它只显示朋友的帖子。
我的查询如下:
SELECT
*
FROM
ajee_friends
JOIN
ajee_wall
ON
ajee_friends.fid = ajee_wall.uid
WHERE
ajee_friends.uid = '$this->uid'
Hey everybody. So, I'm creating this kind of a social network script for a project of mine and i need it to display a news feed similar to facebooks feed, that is, to display your friends posts and your own posts...but with my technique it only displays friends post.
my query is the following:
SELECT
*
FROM
ajee_friends
JOIN
ajee_wall
ON
ajee_friends.fid = ajee_wall.uid
WHERE
ajee_friends.uid = '$this->uid'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你想要你的朋友和你自己的墙,可以这样做(在我看来,作为子选择更具可读性):
If you want the wall of your friends and your own this can be done (in my opinion more readable as subselect):
我认为你可以使用 Union all...
例如,
SELECT * FROM ajee_friends UNION ALL SELECT * FROM ajee_wall
它会显示您和您朋友的所有帖子。您可以让它只显示几行,但有限制。
I think you can use Union all...
something like,
SELECT * FROM ajee_friends UNION ALL SELECT * FROM ajee_wall
It'll show all of your post and your friends'. You can make it show just a few lines with limit.