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
How can we use mapping variables in informatica? Where do we use them?
Define joiner transformation?
What is meant by lookup transformation? Explain the types of lookup transformation?
How to elaborate tracing level?
Define filter transformation?
EXL informatica Questions
Explain in detail about scd type 1 through mapping.
What is dimensional table? Explain the different dimensions.
What are the features of complex mapping?
What is a repository? And how to add it in an informatica client?
Explain pushdown optimization $pushdownconfig parameter - informatica
Explain joiner transformation in informatica
how lookup transformation is made active in new versions... When to use connected and when to use unconnected lookup and why? which is good for session performance. How to make lookup persistent and how to remove stale data from that lookup. how commit works - when we stop or abort data. Explain in both cases. What is factless fact table and have you ever used it in real time scenarios.
can we override a native sql query within informatica? How do we do it?
What is an expression transformation in informatica?