条件
如果Customer_country ='A'
答案 0 :(得分:1)
您应该使用where
子句代替case when
使用||
方法合并A2
或B2
等字符,然后您可以将其排除。
SELECT *
FROM master as t1
WHERE
t1.Customer_number <> t1.Customer_Country || '2'
AND
t1.Ship_Country = t1.Customer_Country
修改强>
如果customer_number类似于'981432776',您可以使用NOT IN
排除。
SELECT *
FROM master as t1
WHERE
t1.Customer_number NOT IN ('A2','B2','C2','D2')
AND
t1.Ship_Country = t1.Customer_Country