SQL Join on 2 Tables -
I am trying to create this query. Hopefully someone can help me have 2 tables
1 in the table
code | Name | Price | Term 1 Name 1 1 2010 2 Name 2 2 2010
Table 2 contains
code | Name | 1 Name 1 2 Name 2 3 Name 3 4 Name 4
What do I want to show
1 name 1 1 2 Name 2 2 3 Name 3 4 4 Name 4 0 In some examples Table 2 can have a value for all the names in the table, but where there are only 1,2,3 names, I call it each other I want to display but with value of 0 or empty
Try it:
Select T2. *, Isnull as code (T1code, 0) - or leave table 2 to the left to the left External T1 on T1.name = T2.name
You isnull (T1 ) Can be changed as code, 0) as the code
with isnull (T1.value, 0) value
. I'm not sure what you're doing ...
Comments
Post a Comment