Home » SQL & PL/SQL » SQL & PL/SQL » how to find sum of positive salary and sum of negative salary
how to find sum of positive salary and sum of negative salary [message #8649] Wed, 17 September 2003 02:41 Go to next message
NS Jagan
Messages: 6
Registered: September 2003
Junior Member
how to find sum of positive salary and sum of negative salary

ENO SAL
-------- ---------
1 -150
2 300
3 400
4 -100
Re: how to find sum of positive salary and sum of negative salary [message #8651 is a reply to message #8649] Wed, 17 September 2003 03:56 Go to previous message
R.Satish Kumar
Messages: 14
Registered: August 2003
Junior Member
Hi,

Here is the query..

select sum(case when sal < 0 then sal end) negativesalary,
sum(case when sal > 0 then sal end) positivesalary
from Tablename

Happy querrying..

Satish.R
Previous Topic: DECODE
Next Topic: 5th highest salary earner
Goto Forum:
  


Current Time: Wed Apr 24 03:44:51 CDT 2024