-
-
lingquan 初学数据Lv2
发表于2022-4-27 20:23
悬赏10
已解决
楼主
想请问一下怎么用ABI筛选数据,现在我有三张表,假设是A、B、C三张表,三张表都有姓名和身份证号,现在想要筛选出A表中不在B表和C表中的数据,怎么实现
最佳答案
本帖最后由 颜值区总司令 于 2022-4-28 10:13 编辑
用sql数据源来写sql呢,目前找到的方式中,写sql应该是比较简单的
sql:方法一:
用sql数据源来写sql呢,目前找到的方式中,写sql应该是比较简单的
sql:方法一:
使用 not in
select distinct A.ID from A where A.ID not in (select ID from B)
select distinct A.ID from A where A.ID not in (select ID from B)
方法二:
使用 left join...on... , "B.ID isnull" 表示左连接之后在B.ID 字段为 null的记录
select A.ID from A left join B on A.ID=B.ID where B.ID is null
使用 left join...on... , "B.ID isnull" 表示左连接之后在B.ID 字段为 null的记录
select A.ID from A left join B on A.ID=B.ID where B.ID is null
方法三:
select * from B where (select count(1) as num from A where A.ID = B.ID) = 0
select * from B where (select count(1) as num from A where A.ID = B.ID) = 0
2个回答
本帖最后由 颜值区总司令 于 2022-4-28 10:13 编辑
用sql数据源来写sql呢,目前找到的方式中,写sql应该是比较简单的
sql:方法一:
使用 not in
select distinct A.ID from A where A.ID not in (select ID from B)
select distinct A.ID from A where A.ID not in (select ID from B)
方法二:
使用 left join...on... , "B.ID isnull" 表示左连接之后在B.ID 字段为 null的记录
select A.ID from A left join B on A.ID=B.ID where B.ID is null
使用 left join...on... , "B.ID isnull" 表示左连接之后在B.ID 字段为 null的记录
select A.ID from A left join B on A.ID=B.ID where B.ID is null
方法三:
select * from B where (select count(1) as num from A where A.ID = B.ID) = 0
select * from B where (select count(1) as num from A where A.ID = B.ID) = 0