我在 mysql frnd_request中有 2 个表格,nsm_post我想根据用户将帖子分享给小学同学、中学同学等来显示帖子。
frnd_request表引用是用户相互连接的列。 下表结构
1 id
2 user_id
3 frnd_id
4 status
5 referece (how friend are connected to each other like primay, secondary school mate)
6 confirmation
7 note
8 date
nsm_post帖子表show_to是定义登录用户的哪个朋友组可以看到此帖子的字段。
1 id
2 uid (user id of user who posted this post)
3 post
4 ip
5 show_to (to which friend group post will be display)
6 Img_video_name
7 date
SELECT nsm_post.post
FROM frnd_request, nsm_post
WHERE frnd_request.user_id = nsm_post.uid
这应该有效。我想您要做的是将帖子限制为用户的同学。但是,对于您当前的表结构,这实际上是不可能的。您必须设置一个额外的表,如下所示:
主 | UID1 | UID2 | 类型
0 | 10004 |10005 | 同学