in account table
account type amount
ac1 credit 300
ac2 debit 5000
ac3 credit 3000
ac1 debit 4000
ac3 debit 2000
ac2 credit 4000
write a query how to get sum of credit & sum of debit
Answers were Sorted based on User's Feedback
Answer / vijay patil
-----------table lavel credit debit
select
sum(case when type=credit then isnull(amount,0)end)sum_credit,
sum(case when type=debit then isnull(amount,0) end)sum_debit
from account_table;
OR -----------table lavel credit debit
select type,sum(amount)amt
from account_table
group by type;
OR (at accont lavel credit debit)
select account,type,sum(amount)amt
from account_table
group by account,type;
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / sanjay
select type,sum(amount)from account table group by type
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / kamala k n
select type, sum(amount) over (partiton by sid) from tab
| Is This Answer Correct ? | 0 Yes | 0 No |
how may join possible between (requisition with purchase order)
How to handle a single quote in oracle sql?
Can any one explain me when i execute below query.. select months_between('07-JUL-12','10-FEB-12') from dual; Out put:- 4.90322581 How oracle calculate?
What is Read-Only Transaction ?
What query tells you how much space a tablespace named test is taking up, and how much space is remaining?
How would you go about verifying the network name that the local_listener is currently using?
Is primary key = unique key,not null? If yes,please explain IF No,please explain
What is difference between cartesian join and cross join?
How to assign a tablespace to a users in oracle?
Is oracle an operator?
How to Truncate Table in Oracle
What is oracle in java?