RosettaCodeData/Task/Loops-N-plus-one-half/DuckDB/loops-n-plus-one-half.duckdb
2025-08-11 18:05:26 -07:00

14 lines
327 B
Text

create or replace function list_join(lst, joiner) as (
with recursive cte as (
select 0 as ix, '' as s
union all
select ix+1 as ix,
if (s = '', '', s || joiner) || lst[ix+1]::VARCHAR) as s
from cte
where ix < length(lst)
)
select last(s)
from cte
);
select list_join(range(1,11), ', ');