Exist, and your query can still 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 case of non-standard database, where data was entered through spreadsheet files (Excel).
Something else;
When you do OUTER JOINs (ANSI-89 or ANSI-92)
, the criteria specified in ON
clause is applied before JOIN, but when it is applied in clause WHERE
is applied after the junction is done. This can produce many different sets of results and of course a difference in performance.