Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What are the different types of joins in sql?

1797


What is substitution variable in pl sql?

1051


What is sqlexception in java?

999


What program will open a mdb file?

969


Why we use join in sql?

979


tell us something about heap tables. : Sql dba

1101


Does normalization improve performance?

1041


What is compilation error in pl sql?

984


explain what is mysql? : Sql dba

1085


Can we create index on primary key?

973


How to download oracle sql developer?

1113


Which join condition can be specified using on clause?

956


What is index example?

1013


how to check myisam tables for errors? : Sql dba

1321


What is sharding in sql?

990