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

How is indexing done in search engines?

505


Can a view be mutating? If yes, then how?

553


What is the use of nvl function?

593


What are the three pl sql block types?

541


What do we need to check in database testing?

534






How we can update the view?

573


What is sap sql?

512


What are few of the schema objects that are created using PL/SQL?

533


What are tuples in sql?

541


How many primary keys can a table have?

511


Why do we use set serveroutput on?

487


how to get @@error and @@rowcount at the same time? : Sql dba

507


Do prepared statements prevent sql injection?

497


How do we use distinct statement? What is its use?

531


how to analyze tables with 'mysqlcheck'? : Sql dba

524