'SHORTEST_PATH with EXISTS
I have been following the SQL graph database sample as demonstrated here: https://docs.microsoft.com/en-us/sql/relational-databases/graphs/sql-graph-sample?view=sql-server-ver15.
But as I kept working along I had to add an EXISTS to my WHERE clause which already has a MATCH on SHORTEST_PATH. But this is always throwing an error saying the multi-part identifier "<columnname>" could not be bound. I have written a query that shows this on their sample database (GraphDemo):
SELECT *
FROM Person,
friendOf FOR PATH,
Person FOR PATH as Person2
WHERE MATCH (SHORTEST_PATH(Person(-(friendOf)->Person2)+))
AND EXISTS (SELECT * FROM Person p3 WHERE p3.ID = Person.ID)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
