我有一个带有查询的In子句。我想在该IN中添加“ NULL”。
我该如何添加。

这是我的查询

WHERE `e`.`lead_id` IN (
    select lds.lead_id
        from mortgage_lead_leads lds
        where lds.loan_officer_id=60
)


给出10条记录。我想向该In子句添加另一条记录。谁能帮我吗。

最佳答案

您可以将unio与double选择为null

  WHERE `e`.`lead_id` IN
  (select lds.lead_id from mortgage_lead_leads lds
    where lds.loan_officer_id=60
    union
   select null from dual )


或or子句

   WHERE `e`.`lead_id` IN
  (select lds.lead_id from mortgage_lead_leads lds
    where lds.loan_officer_id=60 ) or `e`.`lead_id` is null

10-04 17:13