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 |
|
azim
Starting Member
29 Posts |
Posted - 2002-11-04 : 05:37:15
|
 SELECT NAME,SUM(DEBIT)-SUM(CRIDIT) AS DEBIT ,SUM(CRIDIT)-SUM(DEBIT)AS CRIDIT FROM LEDGERGROUP BY NAME I WANT OT GET ONLY POSITIVE VALUESPLEASE ADVICEazim |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2002-11-04 : 06:22:22
|
quote:
 SELECT NAME,SUM(DEBIT)-SUM(CRIDIT) AS DEBIT ,SUM(CRIDIT)-SUM(DEBIT)AS CRIDIT FROM LEDGERGROUP BY NAME I WANT OT GET ONLY POSITIVE VALUESPLEASE ADVICEazim
SELECT NAME,SUM(DEBIT)-SUM(CRIDIT) AS DEBIT ,SUM(CRIDIT)-SUM(DEBIT)AS CRIDIT FROM LEDGERGROUP BY NAMEHAVING SUM(CRIDIT)-SUM(DEBIT) > 0 |
 |
|
|
azim
Starting Member
29 Posts |
Posted - 2002-11-04 : 17:03:47
|
| thanks for reply questionif the return value < 0 (negative) then write (0)insteadazim |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2002-11-05 : 04:07:24
|
quote: thanks for reply questionif the return value < 0 (negative) then write (0)insteadazim
Case when value < 0 then 0 else value end as value |
 |
|
|
|
|
|