Answer the question
In order to leave comments, you need to log in
Where is it better to put the condition “t2.[p] = @p“, in JOIN or in WHERE?
Table t2 is large, the condition restricts the sample.
SELECT *
FROM [dbo].[table1] AS t1
FULL JOIN [dbo].[table2] AS t2 ON t2.[id] = t1.[t2_id]
AND t2.[p] = @p
WHERE t2.[p] = @p
AND (t1.[id] IS NULL
OR t2.[id] IS NULL)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question