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 to name query output columns in oracle?
How to convert character types to numeric types?
what is the difference between data migration and production migration.
How to return top 5 rows in oracle?
i want to know about mr.b.kotravel......who has answered for second maxmium salary from employee table
What is null value in oracle?
What is difference between SUBSTR and INSTR?
What is the quickest way to fetch the data from a table?
dear sir/madam, i have done my engg in 2007 after that i did oracle course (sql,plsql,forms,reports) .from 2008 to 2009 i searched job but didnt got.so i planned to move to sales field & i gone to dubai.till now i m in sales only.now i want to shift my career in to IT industry.but now people are not hiring as fresher.so i planned put fake 1 + exp. is it good or bad or any other way is there to enter in IT.please suggest me or call me 09632087338.
What are the different windows events activated at runtime ?
How to write an inner join with the where clause in oracle?
What do you mean by redo log file mirroring?