Reputation: 21
I need to convert ['a','b'] as ('a','b') in single line
I tried below one
with item as ( select ['a','b'] as list )
select array_to_string(list,''',''') from item
Am getting
Output : a,b
Expected : a','b
Upvotes: 1
Views: 147
Reputation: 173038
Consider below
with item as (
select ['a','b'] as list
)
select "('" || array_to_string(list, "','") || "')"
from item
with output
Upvotes: 2