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

Explain the purpose of %type and %rowtype data types with the example?

556


How to create your own reports in sql developer?

544


what is transaction? : Sql dba

532


how to decrement dates by 1 in mysql? : Sql dba

584


Explain what is a field in a database and record in a database?

612






Is big data nosql?

514


What is an exception in PL/SQL? What are the two types of exceptions?

632


Which are the different types of indexes in sql?

563


What is cross join sql?

504


What is exit statement?

550


what are numeric data types? : Sql dba

582


How do I write a sql query in pgadmin 4?

558


What are conditional predicates?

589


What are inner and outer joins examples of both?

500


How to make a copy values from one column to another in sql?

580