Home I am trying to join two tables I want null values to be equivalent to ALL
Reply: 0

I am trying to join two tables I want null values to be equivalent to ALL

user1121
1#
user1121 Published in July 17, 2018, 7:55 am

Lets say that I have two tables:

table 1 columns: A,B,C
table 2 columns: D,E,F

JOIN Conditions
table1.A = table2.D, table1.B=table2.E, table1.C = table2.F

Any column can have a null value. I want null values to be treated as a match for any value. (i.e if A=D and B=E, but C is null. F has two values for A=D and B=E. Both rows should be included in the resultant table)

Table1:                                Table2:
A:         B:       C:                D:           E:          F:
a          b         c                 a           b           c
e          <null>    f                 e           a           f
o          <null>    q                 e           b           f             
h          i         j                 h           i           k
l          <null>    m                 l           a           m
o          <null>    q                 o           <null>      q


results(show table 2 values...):
D:   E:     F:
a    b      c
e    a      f
e    b      f
o   <null>  q
l    a      m
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.315987 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO