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

Why is nosql good?

584


Write an sql query to select all records from the table?

550


How do you select unique values in sql?

494


What view means?

546


How do you delete a table?

527






Why do we use triggers?

506


Are there any features that are decommissioned in 11g that are not present in 11g?

1580


What jobs use sql?

517


how to add a new column to an existing table in mysql? : Sql dba

576


what is the difference between $message and $$message? : Sql dba

540


How does an execution block start and end in pl sql?

491


What are basic techniques of indexing?

833


Can we alter stored procedure?

533


Can we commit in trigger?

539


How does left join work in sql?

503