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

SELECT CITY,
SUM(DECODE(GENDER,'MALE',NO)) MALE ,
SUM(DECODE(GENDER,'FEMALE',NO)) FEMALE
FROM TABLE_NAME GROUP BY CITY

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain joiner transformation in informatica

664


what are all the deliverables of ETL informatica power center project? what are all updated or created by etl developer as his everyday activities?

1767


waht type of interface is used for testing the data in informatica

1828


Explain the aggregator transformation?

623


Calculate sum of salaries department wise. Then the sum will be repeat for all columns in each department. Develop a mapping for this.

1832






How do you take back up of repository?

715


What is a sequence generator transformation?

570


What are the new features of Power Center 5.0?

1228


What are the advantages of using informatica as an etl tool over teradata?

560


What happen if you have 3 ports in SQ and 4 ports in SQL override of SQ( provided all ports are in same order and they are connected with proper source and target)? Also what happens when I have 4 ports and will extract 3 values in SQloverride.. What will be the value in 4th port ?

1177


In which transformation you cannot drag ports into it?

774


Which means the first record should come as last record and last record should come as first record and load into the target file?

608


COM components can be used in Informatica

1867


What is powercenter on grid?

686


Describe the impact of several join conditions and join order in a joiner transformation?

639