返回值运算符Exists,同表不同条件达成查询

--语法:
select a.Vin,a.DealerCode from PDIFeedback a --4.主表查出这个TRUE
where exists --1.exists返回值是布尔类型只返回 TRUE(真) 或 逻辑假值 FALSE(假)
(select 1 from PDIFeedback b --2.子查询PDIFeedback表b ,select 1 表示满足则1不满足则null
where a.vin = b.vin and a.DealerCode <> b.DealerCode) --3.条件是:a.vin = b.vin and a.DealerCode <> b.DealerCode,如果有这个数据就返TRUE

 

posted @ 2023-02-23 16:35  小小小白丶  阅读(120)  评论(0)    收藏  举报