根据二度人脉推荐好友sql
Jun 07, 2016 pm 03:59 PMfriend表结构 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表结构
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 '好友状态 0 : 删除, 1:申请好友, 2 : 好友',
primary key(uid, friend_uid)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '好友表';
select friend_uid from
friend where state=2 anduid 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的用户查询二度人脉好友

인기 기사

인기 기사

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Hibernate 프레임워크에서 HQL과 SQL의 차이점은 무엇입니까?

삭제된 위챗 친구를 복구하는 방법 삭제된 위챗 친구를 복구하는 방법

상대방이 WeChat에서 나를 삭제했는지 어떻게 알 수 있나요? - 친구가 나를 삭제했는지 확인하는 방법

삭제된 위챗 친구를 복구하는 방법 삭제된 위챗 친구를 다시 추가하는 방법
