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...

write sql query following table

city gender no
chennai male 40
chennai female 35
bangalore male 25
bangalore female 25
mumbai female 15

i want the required output

city male female
chennai 40 35
bangalore 25 25
mumbai 15

Answer Posted / venky

select city,sum(c1) male,sum(c2) female from(select
city,decode(gender,'male',no,0)
c1,decode(gender,'female',no,0) c2 from tablename) tablename
group by city;

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain pushdown optimization $pushdownconfig parameter - informatica

1078


What is the need of etl tools?

1051


While migrating the data from one environment to another environment how would you manage the connections?

1046


What are the different types of olap? Give an example?

973


If the source has duplicate records as id and name columns, values: 1 a, 1 b, 1 c, 2 a, 2 b, the target should be loaded as 1 a+b+c or 1 a||b||c, what transformations should be used for this?

9971


Please tell me which institute is the best to study Informatica and asp.net in chennai Also please send me the latest interview questions in asp.net,c# and sql server to my id ramtryin@gmail.com

1974


What is Cognos script editor?

4162


What is transformation?

1049


How to extract the informatica rejected data?

1161


What is a sequence generator transformation?

950


Differentiate between a database and data warehouse?

1089


What is enterprise data warehousing?

986


How to extract sap data using informatica?

983


Please let me know how to make Data masking in informatica..

1662


Give some information on report bursting and how to do it in bca as I have to split the report and send different reports to different people?

999