mysql人脉图_根据二度人脉推荐好友sql
friend表結(jié)構(gòu) DROP TABLE IF EXISTS FRIEND; create table friend( uid bigint not null comment '用戶標識', friend_uid bigint not null comment '申請加為好友的用戶標識', sys_create_date datetime not null comment '申請時間', sys_last_update datet
friend表結(jié)構(gòu)
DROP TABLE IF EXISTS FRIEND;
create table friend(
uid bigint not null comment '用戶標識',
friend_uid bigint not null comment '申請加為好友的用戶標識',
sys_create_date datetime not null comment '申請時間',
sys_last_update datetime not null comment '更新時間',
state tinyint not null comment '好友狀態(tài) 0 : 刪除, 1:申請好友, 2 : 好友',
primary key(uid, friend_uid)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '好友表';
select friend_uid from
friend where state=2 and
uid in (select friend_uid from friend where uid=13 and state=2)
and friend_uid not in (select friend_uid from friend where uid=13 ) and friend_uid != 13 limit 6
uid為當前用戶的ID,為id為13的用戶查詢二度人脈好友
本條技術(shù)文章來源于互聯(lián)網(wǎng),如果無意侵犯您的權(quán)益請點擊此處反饋版權(quán)投訴
本文系統(tǒng)來源:php中文網(wǎng)
總結(jié)
以上是生活随笔為你收集整理的mysql人脉图_根据二度人脉推荐好友sql的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何破解无线网络密码(无线网络密码破解)
- 下一篇: 数据库表设计(一):字段设计规范和命名规