Left join and filter NULL doesnt work!

Database
Fan

Left join and filter NULL doesnt work!

Hi, i have 2 tables

Table 1

colA colB colC

A1 A2 A3

B1 B2 B3

Table 2

colA colB colC

A1 C2 C3

D1 D2 D3

Table 1 left jon Table 2 on colA

colA colB colC colAA colBB colCC

A1 A2 A3 A1 C2 C3

B1 B2 B3 ? ? ?

But when I want to filter out the colAA that is null, it doesnt work. The result is still return the same. The result that i wanted is only first row is return.

select * from table 1 a

left join table 2 b on a.colA = b.colA

where b.colAA is not null

Anything wrong with my code?

Thanks!

3 REPLIES
Enthusiast

Re: Left join and filter NULL doesnt work!

Your query should not return NULL record:

select * from table1 a
left join table2 b on a.colA = b.colA
where b.colA is not null
Teradata Employee

Re: Left join and filter NULL doesnt work!

Please provide the query, results, explain and database release.

Junior Contributor

Re: Left join and filter NULL doesnt work!

Your query should work as expected.

But if you want to remove NULLs in table2, why don't you use an Inner Join instead?