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 bitemporal narrowing?

1003


what are the different type of normalization? : Sql dba

765


How do you optimize a stored procedure query?

739


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

795


how tsql statements can be written and submitted to the database engine? : Transact sql

716






Does sqlite need a server?

742


How many types of keys are there in sql?

757


what is the difference between rownum pseudo column and row_number() function? : Sql dba

811


why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba

791


Write the command to remove all players named sachin from the players table.

923


- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?

1582


How to check if a column is nullable before setting to nullable?

776


Explain autonomous transaction.

846


How can get second highest salary in sql?

691


How do I remove all records from a table?

771