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
What is primefaces used for?
State the difference between a primary key and foreign key?
How to declare a local variable?
What are the set operators union, union all, minus & intersect meant to do?
What are the different pseudo commands? Explain in general?
What are data pump export and import modes?
What operating systems are supported by oracle database 10g xe?
Why use resource manager in Oracle?
What is where clause in oracle?
what is the use of system.effective.date variable in oracle?
What are the uses of Database Trigger ?
How to delete multiple rows from a table in oracle?
What is oracle rownum?
Can we commit inside a function in oracle?
What is the usage of save points in oracle database?