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 tns entry?

621


How to increment dates by 1 in oracle?

557


Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given procedure owned by SCOTT to start Wednesday at 9AM and to run subsequently every other day at 2AM.

1502


How to create additional tablespaces for an new database?

570


22. Display the order number, number of lines in the order, total number of items and total value for all orders that have a total value greater than $100

1602






HI ALL, CAN ANYONE TELL ME THE DIFFERENCES BETWEEN SQL CLUSTURS,MSQL CLUSTERS,ORACLE CLUSTERS.......THANKS IN ADVANCE

1784


How do I use unicode codesets with the weblogic jdriver for oracle driver?

549


when we are importing items in inventory, showing errors, Oracle support suggested us for running scripts & also suggested if we run scripts, iprocurement applicaation if is there it will show shared and if we go in future for iprocurement, it wont work. So kinldy suggest any functional solution.

1467


query optmization techniques and quwry analyser+projects+ppts

1925


How to install oracle database 10g xe?

560


What are the oracle built-in data types?

560


What is rowid and rownum in oracle?

541


What is the exact use of Collections?

1680


How would you begin to troubleshoot an ORA-3113 error?

1601


How to use existing values in update statements using oracle?

545