Find all the path between two nodes of Azure SQL database
priyanka
0
Reputation points
I wan to get columns from association table in SELECT caluse , Is there any other way around for this?
SELECT subgraph, subgraph as name, Typecode,aid,nbr
FROM (
SELECT
i1.Typecode AS Typecode,
i1.ID AS aid,
i1.Number AS nbr,
STRING_AGG(i2.code, '->') WITHIN GROUP (GRAPH PATH) AS subgraph,
LAST_VALUE(i2.code) WITHIN GROUP (GRAPH PATH) AS LastNode,
COUNT(i2.code) WITHIN GROUP (GRAPH PATH) AS levels
FROM en AS i1,
rela FOR PATH AS d,
en FOR PATH AS i2
WHERE MATCH(SHORTEST_PATH(i1(-(d)->i2)+))
) AS Q WHERE Q.Levels = 1
Thanks