更新SQL FIDDLE 链接https://www.db-fiddle.com/f/9t63on5kYWUNrHqXkThb1P/4
输出应仅提供以下内容(表 1 的第 2 行)
I0016,I0028,I0045,I0056,I0215,I0321,I0361,I0369,I0420
我应该
select column1 from table1
where <any comma separated value in column1> not in
(select col2 from table2 where col1 = 'e')
首选解决方案是本机 SQL,没有特定于供应商的内容。如果需要,spark sql 函数有帮助。
注意:我知道这是一个糟糕的设计,但这是我无法控制的。
注意FIDDLE 中的表是使用 MySQL 的默认设置创建的。我不知道这些表是如何在后端创建的。这就是为什么我指定这不应该是供应商特定的。
以下相关子查询适用于我的情况。可以在上面的小提琴中测试它。
select *
from table1 as t1
where (
select t2.col2
from table2 as t2
where t1.column1 like concat('%', t2.col2 ,'%')
and t2.col1 = 'e'
limit 1
) is NULL;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句