i have one table with accounts and amounts as
colums.accounts with columns c and d. and amounts with
values 1000,2000,3000 for c and 4000,5000,8000 for d.i need
to find the sum of these accounts c and d individually
and find the differences between their sum using one select
statement.

Answer Posted / vijay sinha

select (select sum(amount) from table_name where account = 'C') - (select sum(amount) from table_name where account = 'D')

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sql keyword?

559


Why do we use procedures in pl sql?

518


What packages(if any) has oracle provided for use by developers?

5026


What is sql*loader and what is it used for? : aql loader

618


Explain isolation levels. : Transact sql

575






What is a mutating table and a constraining table?

569


what are the authentication modes in sql server? How can it be changed? : Sql dba

701


What is dml with example?

515


what are the advantages of using stored procedures? : Sql dba

613


what is union, minus and interact commands? : Sql dba

657


Which is better stored procedure or query?

544


Does asenumerable execute the query?

596


Can you inner join the same table?

527


What is a subquery in sql?

507


What is optimistic concurrency control? : Transact sql

545