您知道如何从以下任务中分离出结果吗..
我有一列包含以下值:
col_1
10001A
10001A10002A
10001A10002A10003A
10004A
10004A10005B
10006A
10007A
10007A10008A
我应该只选择没有后代的行 -
col_1
10001A10002A10003A
10004A10005B
10006A
10007A10008A
最佳答案
您需要类似的条件才能找到这些行:
select *
from the_table t1
where not exists (select *
from the_table t2
where t2.col_1 like t1.col_1||'%'
and t1.col_1 <> t2.col_2);
关于sql - 如何从父字符串中分离出结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56614829/