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 / biswaranjan

this works good for the query


select (select sum(a.amount) from one a where
a.account='d')-(select sum(b.amount) from one b where
b.account='c') from dual;

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best free sql database?

564


What is the difference between local and global temporary table?

548


How do you take the union of two tables in sql?

515


What is benefit of creating memory optimized table?

537


What are two statement types in sql?

536






how to drop an existing view in mysql? : Sql dba

568


What are records give examples?

560


What are all the different types of indexes?

618


Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?

666


what are the nonstandard string types? : Sql dba

601


what is a constraint? Tell me about its various levels. : Sql dba

561


How do I view a table in sql?

543


What is sql and how does it work?

547


what happens if you no create privilege in a database? : Sql dba

529


What are expressions?

563