I am simply querying a table
select label, proces, product from Signalering sig
What I want to add to this query is the chance to JOIN the result of the Select with 3 different tables. Let's say the case of joining with 1 table only. The query would look like:
select label, proces, product from Signalering sig
JOIN ScreeningLabelAuthorizationLock p
ON sig.label = p.Value
Now I want to join in the same way, at the same time, the result of the select with 2 more table. In my mind it would look like this:
select label, proces, product from Signalering sig
JOIN ScreeningLabelAuthorizationLock p
ON sig.label = p.Value
JOIN ScreeningProcessAuthorizationLock q
ON sig.proces = q.Value
JOIN ScreeningProducthAuthorizationLock s
ON sig.proces = s.Value
The result is not the expected one because the join works on the result of what comes before it, while I want it to be working from the Select statement. Thanks in advance!
EDIT: the correct result is given by the following query:
select [signaleringid], label, proces, product from Signalering sig
JOIN ScreeningLabelAuthorizationLock p
ON sig.label = p.Value
union
select [signaleringid], label, proces, product from Signalering sig
INNER JOIN ScreeningProcessAuthorizationLock q
ON sig.proces = q.Value
union
select [signaleringid], label, proces, product from Signalering sig
INNER JOIN ScreeningProductAuthorizationLock r
ON sig.product = r.Value
What I am looking is a way to avoid 3 Select queries and make it be only 1.