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 / sudheer
Select ABC.CITY AS CITY, sum(ABC.male) as MALE, sum(ABC.Female) as FEMALE from
(
select city, Sum(no) as male, NULL AS female from table_name
where gender = 'male'
Group by city
UNION
select city, NULL as male, SUM(no) AS female from table_name
where gender = 'female'
Group by city
) ABC Group by CITY
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is transformation?
Explain the code page compatibility?
How do you load only null records into target? Explain through mapping flow.
Reusable transformation and shortcut differences
explain about unit testing? in real time?
What is a sequence generator transformation?
What is the difference between informatica 7.0 and 8.0?
What are the different lookup cache(s)?
scenario where i can use only concurrent execution of workflow.
Explain about Informatica server process that how it works relates to mapping variables?
While importing the relational source definition from the database, what are the metadata of source that will be imported?
How can you differentiate between powercenter and power map?
What are ETL Tools?
What are the different ways to implement parallel processing in informatica?
Source and Target are flat files, Source table is as below ID,NAME 1,X 1,X 2,Y 2,Y On Target flat file i want the data to be loaded as mentioned below ID,NAME,REPEAT 1,X,2 1,X,2 2,Y,2 2,Y,2 How to achieve this, Can i get a map structure