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

SELECT ABS(SUM(DECODE(ACCOUNTS,'C',AMOUNTS))-SUM(DECODE
(ACCOUNTS,'D',AMOUNTS))) FROM TEMP

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are aggregate and scalar functions?

517


Is mariadb a nosql database?

529


Can we rename a column in the output of sql query?

533


Explain some predefined exceptions.

572


How to look at the current sql*plus system settings?

595






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

574


what is the difference between char_length and length? : Sql dba

559


What is the use of non clustered index?

516


What are triggers and its types?

540


What is the difference between union and union all command?

532


Do prepared statements prevent sql injection?

517


What is a dirty read sql?

466


Define SQL and state the differences between SQL and other conventional programming Languages?

669


How can you load multi line records? : aql loader

647


what are null values? : Sql dba

530