2018-08-08

SELECT a.`count` fans_num, c.introduce, c.area, 
 CASE 
 WHEN b.user_id IS NULL THEN '0' 
 ELSE '1' 
 END as is_follow 
 FROM ( 
 SELECT follow_user_id, count(*) as `count` FROM tt_user_follow WHERE follow_user_id =   v 
 ) as a 
 LEFT JOIN ( 
 SELECT user_id FROM tt_user_follow WHERE user_id =   v   && follow_user_id =   str_user_id 
 ) AS b 
 ON a.follow_user_id = b.user_id 
 LEFT JOIN ( 
 SELECT user_id, introduce, area FROM tt_user_auth WHERE user_id =   v 
 ) AS c 
 ON a.follow_user_id = c.user_id;

你可能感兴趣的:(2018-08-08)