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 is the benefit of foreign key?

1071


Which sorts rows in sql?

1058


How to prepare for oracle pl sql certification?

1109


How can you create an empty table from an existing table?

1129


what are the different tables present in mysql? : Sql dba

1046


How to combine two stored procedures in sql?

1326


Why do we need unique key in a table?

1008


Are dml statements autocommit?

1096


what is “go” in t-sql? : Transact sql

1158


What is the difference between pl and sql?

1153


What is microsoft t sql?

986


How do I partition in sql?

1023


I need a function for a train ticket reservation please answer it thanks in advance

1078


Which sql statement is used to return only different values?

1058


What is sql resultset?

1043