我的好友 (user_user_friend [id, user_id int(11,index), friend_id(int[11]), input_time(datetime)])
建立一个 好友的关联表 id自动增长的 user_id 是我自己的关联 id friend_id 是好友的关联id
我怎么查询两个表 能查出 我的一个 user_id =6 的好友的详细信息
建立一个 好友的关联表 id自动增长的 user_id 是我自己的关联 id friend_id 是好友的关联id
我怎么查询两个表 能查出 我的一个 user_id =6 的好友的详细信息
select * from friend,user_user_friend where user_user_friend.user_id=6 and user_user_friend.friend_id=friend.id;
1 2 4
2 2 45
3 2 35
4 2 11
5 2 1
6 2 41
7 6 1
8 4 2
select a.fields, b.fields from a, b where a.id = b.id
然后 用户id 后边的 好友关联id 我想要的就是 好友id 的详细 信息
我想要的 是 好友的用户资料
两个表格 通过 用户的 id 先进行一次关联
能查出 这个用户的所有好友
但通过 好友 id 的关联 查出 好友的资料