表A: 表B:
id id
title user_id
content author_id
user_id
select a.content, (case when b.author_id is not null then '1' else '0' end )as Rem
from topic a LEFT JOIN attention b on a.user_id = b.author_id
我想查询A表所有信息。根据表B用户关联的作者增加伪列。进行判断
...全文
10375打赏收藏
SQL 查询某个用户是否有关注作者
表A: 表B: id id title user_id content author_id user_id select a.content, (case when b.author_id is not null then '1' else '0' end )as Rem from topic a LEFT JOIN attention b on a.user_id = b.author_id 我想查询A表所有信息。根据表B用户关联的作者增加伪列。进行判断