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 are the sql versions?

522


What is case function?

602


What is the use of double ampersand (&&) in sql queries? Give an example

613


what is the difference between inner and outer join? Explain with example. : Sql dba

549


what is sp_pkeys? : Transact sql

699






How do you drop a trigger?

543


Why is pl sql used?

527


what are the authentication modes in sql server? : Sql dba

536


What are the different types of functions in sql?

515


what happens if null values are involved in expressions? : Sql dba

565


what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba

530


What is the difference between inner join and outer join?

532


Can we use ddl commands in pl sql?

560


Can you load data into multiple tables at once? : aql loader

604


What are the disadvantages of file system?

617