SELECT fid FROM TABLE WHERE uid=selfId (我关注的用户)
SELECT COUNT(*) FROM TABLE WHERE fid=selfId (我的粉丝数)
SELECT b.uid FROM TABLE a, TABLE b WHERE b.fid = a.uid AND a.fid = b.uid(互粉的ID)
SELECTaa.id,
aa.playerid,
aa.friendid,
IF (bb.friendid IS NULL, 'N', 'Y')
FROM
(
SELECT
*
FROM
my_test a
WHERE
a.playerid = 10011
) aa
LEFT JOIN (
SELECT
*
FROM
my_test a
WHERE
a.playerid = 10012
) bb ON aa.friendid = bb.friendid
ps:把my_test 换成你自己的表名
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)