Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replacing NULL with 0
Message
From
29/09/2004 00:37:41
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Replacing NULL with 0
Miscellaneous
Thread ID:
00947052
Message ID:
00947052
Views:
52
Hi ol!

I use this syntax to retrieve data and separate a single money column into a debit and credit column. This works well except that it displays values in a column without a corresponding valid value. Like if for my CASH account I have a DEBIT amount and nothing for my CREDIT amount, a value is displayed on the CREDIT column. Is there a command I can use within this syntax so that instead of displaying a zero (0) value will be displayed instead?

Thanx!

Martin

SQL Commands:
Select
t2.AcctID,
t2.IDNo,
t1.Nme,
(Select
Sum(Amount)
From zTemp2
Where zTemp2.AcctID=t2.AcctID and
zTemp2.IDNo = t2.IDNo and
zTemp2.Amount>0) Debit,
(Select
Sum(Amount)
From zTemp2
Where zTemp2.AcctID=t2.AcctID and
zTemp2.IDNo = t2.IDNo and
zTemp2.Amount<0) Credit,
sum(t2.Amount) Amount
From zTemp2 t2
inner join zTemp1 t1 on t2.IDNo = t1.IDNo
Group By
t1.Nme,
t2.IDNo,
t2.AcctID
Order By t1.Nme, t2.AcctID
Shit happens!!!
Next
Reply
Map
View

Click here to load this message in the networking platform