acname actype amount
ac1 credit 300
ac2 credit 4000
ac1 debit 4000
ac2 debit 455
ac1 credit 500
how to get sum of credit and sum of debit for each account

Answer Posted / terence

select
acname,
sum(decode(actype,'credit',amount,0)) Credit,
sum(decode(actype,'debit',amount,0)) Debit
from account_table
group by acname

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is query image?

586


Iam learning oracle developer 2000.. can anyone give me then tutorials sites or PDF related to developer 2000 please send me the details @ mak2786@gmail.com thanks Arun

1666


How to use "in out" parameter properly?

620


How to create a table in a specific tablespace?

546


How to update values in a table in oracle?

580






How to create a stored function in oracle?

593


How will you write a query to get a 5th rank student from a table student_report?

1381


How to use an explicit cursor without open statements?

616


How to use windows user to connect to the server?

536


What is raw datatype?

595


What are the roles of dba?

614


Please explain compound trigger in oracle?

603


How do I call oracle stored procedures that take no parameters?

570


How to define default values for formal parameters?

598


What is format trigger?

1618