sql - Joining an ID with a NULL -


i'm trying join table of data table, 1 of id i'll joining on null. however, have specific id want link nulls.

i might oversimplifying question example, i'm hoping point me in right direction. suppose have 2 tables below.

table1:

    name    id           1     b       2     c       null 

table2:

    id      value     1       4     2       5     3       6 

what need in query output this?

output:

    name    value           4     b       5     c       6 

thanks in advance assistance.

you can explicitly check in on clause:

select name, value   table1 join   table2 on (table1.id = table2.id) or                   (table1.id null , table2.id = 3) 

Comments