By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
with links as (
select 832781 id, 'index.html' url
union all select 832781, 'index.html'
union all select 832781, 'page.html'
)
SELECT id, JSON_ARRAYAGG(url) AS urlLinks
FROM (SELECT DISTINCT id, url from links) l
WHERE id=832781
GROUP BY id;
id | urlLinks |
---|---|
832781 | ["index.html", "page.html"] |