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 differences between char and nchar? : Sql dba

797


How much does a sql dba make? : SQL DBA

669


Can you call pl/sql package functions from within a fast formula?

769


What is the difference between clustered and non-clustered index in sql?

733


What is trigger price?

731






What are the ways on commenting in a pl/sql code?

673


What is an invalid partition table?

748


What is gpt format?

698


What is coalesce in sql?

732


what is the difference between myisam static and myisam dynamic? : Sql dba

768


What is duration in sql profiler trace?

774


What is procedure function?

708


Is hadoop a nosql?

745


What is coalesce sql?

695


What are the sql versions?

672