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 a mapplet/worklet in informatica?
how tokens will generate?
Briefly describe lookup transformation?
Can informatica load heterogeneous targets from heterogeneous sources?
What are the different lookup cache(s)?
Suppose we do not group by on any ports of the aggregator what will be the output?
How many ways a relational source definition can be updated and what are they?
permutations of mapplet
1)you have multiple source system where u receive files ,how do you actually load into mapping using transformation,what are the transformation you use? 2)you have files in ftp location ,how do you get it into mapping with you ETL concept?
Can you use flat files in Mapplets.
How to create or implement slowly changing dimension (SCD) Type 2 Effective Date mapping in informatica/Flagging mapping in informatica/visioning mapping in informatica?
What are the tasks that source qualifier perform?
What is meant by lookup transformation?
Please let me know how to make encryption and decryption with example?
what are the best practices to extract data from flat file source which are bigger than 100 mb memory?