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 clustered table in Oracle?
How do I find the database name in oracle?
What are nested tables?
How to open and close an explicit cursor in oracle?
What is query image?
Why packages are used in oracle?
What happens internally when the user types userID/password@string in SQL PLUS Thanks-Bhaskar
What are joins, explain all types of joins?
How to delete a user account in oracle?
Can you create a synonym without having a table?
What is PL/SQL ?
How many categories of data types?
What is a view and how is it different from a table?
What is control file used for?
What is a trigger oracle?