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

How to revise and re-run the last sql command?

1098


What are the different types of dbms?

953


Is sql pronounced sequel or sql?

1212


when MSQL8.0 is in market

2014


How to combine two stored procedures in sql?

1119


what is self-join? : Sql dba

1054


What is difference between cursor and trigger?

1016


how to select unique records from a table? : Sql dba

1053


What is trigger in sql and its types?

989


What are stored procedures in mysql?

967


Can we use threading in pl/sql?

970


How can you fetch common records from two tables?

1000


How many types of keys are there in sql?

985


how can we optimize or increase the speed of a mysql select query? : Sql dba

883


Is sql a oracle?

913