|
Home > Archive > MS SQL Data Warehousing > March 2006 > left outer join
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Magnus Österberg 2006-03-06, 7:23 am |
| Hi!
I wish to join two tables.
The first one is:
....which contains the hours from 00 to 23.
The second is this my query, which I would like to return rows also in cases where the Amount of CreationTime is zero. That is, I would like to join in null values from the tblTempVarauksienKel
lonaika-table. But, why doesnät my query do that, as it is?
Magnus
| |
|
|
| Magnus Österberg 2006-03-10, 7:23 am |
| still the same... :(
"Jéjé" < willgart@BBBhotmailA
AA.com> wrote in message news:eF6HpNlQGHA.4976@TK2MSFTNGP11.phx.gbl...
everything you return come from the "B" table!
how can you return null values if the left join table is not use has the primary source for the select statement?
?
also, move the where clause into the "on" part of the query like:
select vk.hour , B...., B.....
from VK left join B
on vk.hour = left(b.creationtime,2) AND b.creationdate between......
group by VK.HOUR
has you can see, the hour returned is the hour fron the VK table, not the B table.
|
|
|
|
|