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 are the different types of repositories created using informatica?
Please let me know how to make encryption and decryption with example?
How does the aggregator transformation handle null values?
i have a data in my source as a flat files what test i have to perform the next step can any body help to me
What will happen if the select list columns in the custom override sql query and the output ports order in sq transformation do not match?
What are the new features of informatica 9.x in developer level?
What if the source is a flat-file?
server hot-ws270 is connect to Repository B. What does it mean?
what is size of u r database?
Define Pmrep command?
Parameter and variable differences
What is the way to execute pl/sql script using informatica mapping?
How to use procedural logic inside infromatica? If yes how, if now how can we use external procedural logic in informatica?
Differences between version 7.x and 8.x.
what are the deliverables?in your project?