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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Query Help

Author  Topic 

dewacorp.alliances

452 Posts

Posted - 2003-04-22 : 03:23:57
Hi there

I have these 2 table:

1) maBU_lupFOChargeCodeAccCompYTDBudget :

FinanceCode VARCHAR(8);
AccCompID(5);
2003AnnualBudgetAmt FLOAT

2) maBU_tblBudget :

BudgetLineID INT
FinanceCode VARCHAR(8);
AccCompID VARCHAR(5)
BudgetJul FLOAT
BudgetAugust FLOAT
BudgetSeptember FLOAT

The question is :
1) I want to have LEFT OUTER JOIN OF mabu_lupFOChargeCodeAccCompYTDBudget AND maBU_tblBudget where the join is coming from two fields FinanceCode AND AccCompID. There for if both value FinanceCode AND AccCompID (in the mabu_lupFOChargeCodeAccCompYTDBudget table) are the same with the value of FinanceCode AND AccCompID (in the maBU_tblBudget table) then join these two. Is this possible?

2) The impact of this query will have a null if data exist in the lupFOChargeCodeAccCompYTDBudget but not in the tblBudget. How to replacing NULL with ZERO into BudgetJuly, BudgetAugust and BudgetSeptember ?

Any guidance or help I'm really appreciated?

Thanks,
Isadewa








Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-04-22 : 07:27:43

select
isnull(b.col3,0)
from
tablea a
left join tableb b
on (a.col1 = b.col1 and
a.col2 = b.col2)

 


Jay White
{0}
Go to Top of Page
   

- Advertisement -