I have a some node and edge tables in SQL Server with a one to many relationship to a standard table which store users. Each edge and node table have this 1N relationship.
I would like to know how can I perform a query with match clause and a left join like this :
SELECT * FROM Node1Table n1, EdgeTable e, Node2Table n2
LEFT JOIN UserTable usr ON e.usr = usr.ID
MATCH (n1-(e)->n2)
I could write the query like this :
SELECT * FROM EdgeTable e
INNER JOIN Node1Table n1 ON e.$from_ID = n1.$node_ID
INNER JOIN Node2Table n2 ON e.$to_ID = n2.$node_ID
LEFT JOIN UserTable usr ON e.usr = usr.ID
But I don't know if n1 is from or to object.
I can't do an inner join because e.usr could be null
Thank you for your help
EDIT:
Test 1 :
SELECT * FROM
OBJ_APPLICATION n1, REL_APPLICATION_RESPONSABLE r INNER JOIN
Management_User u on u.[UserID] = r.[CPQ], OBJ_RESPONSABLE n2
WHERE MATCH(n1-(r)->n2)
error : The identifier "r" in a MATCH clause is used with a JOIN clause or an APPLY operator. JOIN and APPLY are not supported with MATCH clauses.
Test 2 :
SELECT * FROM
OBJ_APPLICATION n1, REL_APPLICATION_RESPONSABLE r, OBJ_RESPONSABLE n2
INNER JOIN Management_User u on u.[UserID] = r.[CPQ]
WHERE MATCH(n1-(r)->n2)
error : The multi-part identifier r.CPQ could not be bound
Test 3 :
SELECT * FROM
OBJ_APPLICATION n1, REL_APPLICATION_RESPONSABLE r, OBJ_RESPONSABLE n2, Management_User u
WHERE MATCH(n1-(r)->n2)
AND u.[UserID] = r.[CPQ]
Works with an INNER JOIN but in some cases I have to make a LEFT JOIN