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

How to create a non-reusable instance of reusable transformations?

784


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

1044


How to elaborate tracing level?

789


Quickly characterize reusable change?

804


How would you copy the content of one repository to another repository?

651






What are junk dimensions?

705


Design time, run time. If you don't create parameter what will happen

1519


Design a mapping to load the cumulative sum of salaries of employees into target table?

1027


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

696


What is meant by lookup transformation? Explain the types of lookup transformation?

652


Name the different lookup cache(s)?

810


What is joiner change?

803


What is meant by query override?

738


What is data caches/ index caches?

697


What are the main features of Oracle 8i with context to datawarehouse?

1769