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

Repository user profiles

1377


Different qualification between a related rotate toward the sky and isolates look upward?

556


Differentiate between source qualifier and filter transformation?

1003


How to load last n records of file into target table - informatica

600


How to create the source and target database connections in server manager?

634






What are the transformations that are not supported in mapplet?

602


What are the different types of transformation available in informatica.

639


Hi friends I want to know about what r the dimensions in the banking porjects and genarally how many tables r in project ?

1450


How an expression transformation differs from aggregator transformation?

628


what is SDLC way of code development?

1562


Why sorter is an active transformation?

755


Can anyone tell me the new features in Informatica 9 Version?

1532


How to load the name of the current processing flat file along with the data into the target using informatica mapping?

702


What is the difference between informatics 7x and 8x and what is latest version?

547


source : xml file target: xml file how can we check data loaded into target xml file using writing sql query. pls help on this asap.

2299