Cory Weiner
10/13/2023, 7:38 PMjen
10/13/2023, 10:29 PMjen
10/13/2023, 10:35 PMjen
10/13/2023, 10:35 PMjen
10/13/2023, 10:35 PMSELECT empid,
COALESCE(
emp.custentity_colour,
p.custentity_colour,
gp.custentity_colour,
ggp.custentity_colour,
gggp.custentity_colour,
ggggp.custentity_colour,
gggggp.custentity_colour,
ggggggp.custentity_colour,
gggggggp.custentity_colour,
ggggggggp.custentity_colour
) AS colour
FROM employee emp
LEFT JOIN employee p ON (p.id = emp.supervisor)
LEFT JOIN employee gp ON (gp.id = p.supervisor)
LEFT JOIN employee ggp ON (ggp.id = gp.supervisor)
LEFT JOIN employee gggp ON (gggp.id = ggp.supervisor)
LEFT JOIN employee ggggp ON (ggggp.id = gggp.supervisor)
LEFT JOIN employee gggggp ON (gggggp.id = ggggp.supervisor)
LEFT JOIN employee ggggggp ON (ggggggp.id = gggggp.supervisor)
LEFT JOIN employee gggggggp ON (gggggggp.id = ggggggp.supervisor)
LEFT JOIN employee ggggggggp ON (ggggggggp.id = gggggggp.supervisor)
jen
10/13/2023, 10:35 PMWatz
10/14/2023, 8:02 AMSELECT
e.id,
e.entityId,
e.supervisor,
e.color
,nvl(
color,
(SELECT color
FROM employee e2
WHERE color IS NOT null
START WITH e2.id = e.supervisor
CONNECT BY PRIOR e2.supervisor = e2.id AND PRIOR color IS NULL)
) as inherited_color
FROM employee e
ORDER BY id
Watz
10/14/2023, 8:12 AMSELECT id
FROM employee
WHERE custom_field is not null
CONNECT BY PRIOR supervisor = id
but I can run
SELECT id
FROM employee
WHERE supervisor is not null
CONNECT BY PRIOR supervisor = id
And by that the inner SELECT of previous query shouldn't work?? But as a subquery, it does.Cory Weiner
10/16/2023, 2:05 PM