Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2010-04-08 : 23:43:34
|
| Dear All,I have 2 tableTable A--------NDate NBV NDP1/3/2010 10 202/3/2010 5 64Table B--------ADate ABV ADP1/3/2010 51 64/3/2010 7 81Output Needed--------------Date NBV NDP ABV ADP1/3/2001 10 20 51 62/3/2010 5 64 0 04/3/2010 0 0 7 81Please AdviseThank you.Regards,Micheale |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-08 : 23:53:16
|
[code]select [Date] = coalesce(a.[NDate], b.[ADate]), NBV = coalesce(a.NBV, 0), NDP = coalesce(a.NDP, 0), ABV = coalesce(b.ABV, 0), ADP = coalesce(b.ADP, 0)from tablea a full outer join tableb b on a.[NDate] = b.[ADate][/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|