建立表ui
CREATE TABLE `com_wechat_user_follow` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `uid` bigint(20) NOT NULL DEFAULT '0' COMMENT '用戶ID', `fid` bigint(20) NOT NULL DEFAULT '0' COMMENT '關注用戶ID', `createtime` int(10) DEFAULT '0' COMMENT '關注時間', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用戶關注表';
select `uid` from `com_wechat_user_follow` where `uid`='你的id'
select `uid` from `com_wechat_user_follow` where `fid`='你的id'
select * from `com_wechat_user_follow` where `uid` in ('你的id', '某個用戶id')
select * from `com_wechat_user_follow` where `uid`='你的id' and `fid`='某個用戶id' and `uid` in (select `fid` from `com_wechat_user_follow` where `uid`='某個用戶id')