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



acname actype amount ac1 credit 300 ac2 credit 4000 ac1 debit 4000 ac2 debit ..

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

acname actype amount ac1 credit 300 ac2 credit 4000 ac1 debit 4000 ac2 debit ..

Answer / amit kumar

select sum(amount) amt , acname, actype from table group by
acname , actype

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More Oracle General Interview Questions

Two triggers one is before insert and other is after insert are firing on a table.If 10 times you insert in a table.Then how many times before trigger and how many types after trigger will fire in pl/sql.

1 Answers  


Who i will insert 1 lacks record in a Database table

4 Answers   TCS,


What is the difference between alert log file and tarce file ?

0 Answers   TCS,


What is a Garbage Collection? and what is full recursive Garbage collection?

0 Answers   RBS,


Create table Employee ( Employee_Id varchar2(8) Constraint emp_id_pk primary key, FirstName varchar2(50), LastName varchar2(50), DeptID Number(5) Constraint dept_id_fk Foreign Key(DeptId) References Department(DeptId) ) Error I am getting: Constraint specification are not allowed here

2 Answers  






what is kernel?

2 Answers   Microsoft,


select to_char('10','10') from dual This gives me an error oRA-1481 INVALID NUMBER FORMAT MODEL why? pls help

6 Answers  


How to connect ms access to oracle servers?

0 Answers  


Difference between pre-select and pre-query

0 Answers  


What is cursor

4 Answers   TCS,


can anyone help me ? an index has been done on the primary key of a table. an update operation was performed on that table. now my question is 1> what abt the performance ? means faster or slower due to indexing ? 2> does the operation affect to the primary key constraint ?

2 Answers   Allfon,


How data locks are respected in oracle?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)