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 is sql and its types?

628


What is difference between stored procedure and trigger?

539


What is a design view?

522


What are the 3 modes of parameter?

686


What is sql and db2?

538






What is the use of primary key?

539


Does truncate require commit?

547


Can we insert data into view?

527


Does mysql_real_escape_string prevent sql injection?

539


Is drop table faster than truncate?

555


What is 19 null in sql?

536


how to check myisam tables for errors? : Sql dba

608


Does a primary key have to be a number?

522


write an sql query to find names of employee start with 'a'? : Sql dba

584


what is a unique key ? : Sql dba

547