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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / amit kumar
select sum(amount) amt , acname, actype from table group by
acname , actype
| Is This Answer Correct ? | 6 Yes | 2 No |
Is oracle the best database?
what is the difference between first normal form & second normal form?
difference between imlicit cursor and explicit cursor ?
What is the difference between SQL and SQL Server?
What is the difference between normal and corelated subqueries?
In XIR2 if we lost the administration password .How can we regain the password?thanks in advance.
What is the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN?
How to connect to the server with user account: sys?
What would you do with an in-doubt distributed transaction?
How to convert the date format from dd/mm/yyyy to mm/dd/yyyy. (for eg). 22/05/2008 to 05/22/2008. when u use to_char(), it tells the month is invalid. how to resolve this problem.tel with eg.
What operating systems are supported by oracle database 10g xe?
Is there a combination of "like" and "in" in sql?