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 transport network substrate (tns) in oracle?

594


Hi this srilatha. I comlpeted my Oracle-hrms. can u provide me interview questions on Core hr, payroll,sshr,OLM etc..

1664


What is merge in oracle?

572


What is background process in Oracle?

636


How to bring a tablespace online?

524






Explain user account with reference to oracle.

542


How to export data with a field delimiter?

588


What are the uses of linked server and explain it in detail?

593


Explain an index?

662


What is raw datatype?

597


Explain oracle instance.

686


how do u setup a replication site?

1506


How to convert characters to numbers in oracle?

598


What is open database communication (odbc) in oracle?

553


How to select some rows from a table in oracle?

604