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

Dimension Object created in Oracle can be imported in Designer Cubes contain measures

2012


whats the logic to load the lower level of granularity of data to fact table.

1911


I have two different source structure tables, but I want to load into single target table? How do I go about it? Explain in detail through mapping flow.

750


Suppose we configure sorter transformations in the master and detail pipelines with the following sorted ports in order: item_no, item_name, price. When we configure the join condition, what are the guidelines we need to follow to maintain the sort order?

753


As union transformation gives UNION ALL output, how you will get the UNION output?

731






how we can load rejected record's at run time?(not through bad files)

2011


In what scenario we use to improve session performance by pushdown optimization?can any one give example?

5450


What is expression transformation?

721


Enlist the differences between database and data warehouse.

639


Why union transformation is an active transformation?

751


what is the size of u r source(like file or table)?

1909


Why do you use Mapping Parameter and mapping variable?

1377


Explain the code page compatibility?

731


What is the function of look up transformation?

761


How to load a Dimension ? and how to load a fact table?

1044