Oracle query is:
select t3.id,
t4.caption || '>' || t3.caption
from (
SELECT t1.id as id,
(t2.caption || '>' || t1.caption) as caption,
t2.pid as pid
FROM ParentChild T1, ParentChild T2
WHERE T1.pid = T2.id(+)
) t3,
(
SELECT t1.id as id,
(t2.caption || '>' || t1.caption) as caption,
t2.pid as pid
FROM ParentChild T1, ParentChild T2
WHERE T1.pid = T2.id(+)
) t4
where t3.pid = t4.id(+);
Output:
ID T4.CAPTION||'>'||T3.CAPTION
---------------------- ---------------------------
4 a>b>c>d
3 >a>b>c
1 >>a
2 >a>b
5 >a>e
I need the equivalent SQL Server query...
||string concatenation should be replaced with+.