Exist, and your query might still be able to bring divergent data depending on the fields used in the filters as in the example below ( done in sql server ) problem I had in that question .
declare @tabela1 table(id int , decr varchar(10))
declare @tabela2 table(id int , id2 int null, decr varchar(10))
insert into @tabela1 values
(1, 'tabela 1'),(0, 'tabela 1'),(0, 'tabela 1'),(0, 'tabela 1'),(0, 'tabela 1'),
(0, 'tabela 1'),(0, 'tabela 1'),(0, 'tabela 1'),(0, 'tabela 1'),(0, 'tabela 1'),
(0, 'tabela 1')
insert into @tabela2 values
(1, 1, 'tabela 2'),(1, 2, 'tabela 2'),(0, 1, 'tabela 2'),(0, 1, 'tabela 2')
select *
from @tabela1 a
left join @tabela2 b
on b.id = a.id and a.id = 1
select *
from @tabela1 a
left join @tabela2 b
on a.id = b.id
where a.id = 1
This is a non-standard database case, where data was inserted through spreadsheet inserts (Excel).
Another thing;
When you do OUTER JOINs (ANSI-89 or ANSI-92)
, the criteria specified in the ON
clause is applied before the JOIN, but when applied in the WHERE
clause is applied after the join is made. This can produce many different sets of results and of course a difference in performance.