WITH cte as (
SELECT partnerlist as a FROM support.members WHERE id = 'BB36'
)
SELECT REGEXP_SPLIT_TO_ARRAY('BB36,'||(SELECT a FROM cte), ',')
cte返回null,没有行。
为什么regexp_split_to_array不会返回[BB36]
?
在我的完整查询中,它在where
子句中使用:
AND u.id = any(regexp_split_to_array('BB36,'||(SELECT a FROM cte), ','))
答案 0 :(得分:0)
将CTE更改为此功能使其正常工作:
WITH cte as (
SELECT
CASE WHEN partnerlist IS NULL OR urgpartnerslistori = '' THEN
'XX99'
ELSE
partnerlist
END as a
FROM support.members WHERE id = 'BB36'
)