Sql查询 一个表中某字段的数据在另一个表中某字段中不存在的
比如:cdr表中的CallerId字段中数据在station表中num不存在的
sql语句
SELECT CallerId
FROM ast_cdr WHERE CallerId NOT IN (SELECT number FROM ast_station)
加上条件 并 CallerId 字段 去重复
SELECT DISTINCT CallerId FROM ast_cdr WHERE CallerId NOT IN (SELECT number FROM ast_station) and StartTime>='2024-02-01 00:00:00' and EndTime<='2024-02-29 23:59:59' and CallType='outbound'