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

Hi,
I dont know if this is a intended way for which interviewer
has asked, but it will definitely give an answer,

select (select sum(value) from test_tab where parent='D')-
(select sum(value) from test_tab where parent='C')
difference from dual;

Cheers,
Bunty

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Determine if oracle date is on a weekend?

558


Is left join same as join?

524


What's the difference between a primary key and a clustered index?

520


How do you optimize a stored procedure query?

570


How do I edit a stored procedure?

558






What is string data type in sql?

537


What is on delete restrict?

544


Is mariadb a nosql database?

542


What trigger means?

567


What is pl sql block structure?

545


Explain 3 basic parts of a trigger.

843


how to present a past time in hours, minutes and seconds? : Sql dba

570


What is the difference between sql, mysql and sql server?

533


Explain what is rdbms?

585


What is difference between hql and native sql?

585