【发布时间】:2018-10-27 14:38:30
【问题描述】:
我正在努力让它发挥作用:
with a as (select '1'::varchar(32) as x),
b as (select '10'::varchar(32) as x)
select *
from b
left join a using(x)
where b.x like '%1%'
;
x
----
10
选择了 1 条记录 [获取元数据:0ms] [获取数据:0ms]
但我需要使用的是:
where b.x like '%' || a.x || '%'
;
x
----
0 record(s) selected [Fetch MetaData: 0ms] [Fetch Data: 0ms]
有什么想法吗?
我已经把这个问题放在这里了Redshift LIKE column value with % 这个想法从何而来。
谢谢
【问题讨论】:
-
请分享输入数据和预期输出。为什么要使用第二种语法?
-
看看strpos函数看看a是否在b内
-
@Swapnil,预期输出在第一个块,x=10
-
不要将问题编辑到invalidate existing answers。如果答案与当前答案不同,您可以随时发布答案。
标签: string amazon-redshift sql-like