I have a table like below :
Table_a :
Pos_id col1 col2 value
12221 null null Car
12222 112 1111 Bike
12222 112 1112 Bus
12222 112 1113 Roller
Table_b :
pos_id col1 col2 line_nr
12221 100 1000 1
12222 112 1111 1
12222 112 1112 2
12222 112 1113 3
I want to select the values of table_a whose line_nr is 1 in the table_b.
so I have tried LEFT JOIN.
select * from table_a
left join table_b
on a.pos_id = b.pos_id
and a.col1 = b.col1
and a.col2 = b.col2
where b.line_nr = 1;
So this doesnt select the column that has null in the table_a.
I need to select the below given columns from table_a
Pos_id col1 col2 value
12221 null null Car
12222 112 1111 Bike