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
scenario where i can use only concurrent execution of workflow.
What is a stored procedure transformation?
How to elaborate tracing level?
How to generate sequence numbers without using the sequence generator transformation?
What is meant by query override?
Separate from an archive server and a powerhouse?
explain about unit testing? in real time?
What is a sorter transformation?
Plz can any one say me how to get the informatica certification materials and dumps
Why can't we connect source qualifier and aggrigator transformation to an expression ? Why they resticted to conncet 2 active trasformations to an passive transformation ?
Is stop and abort are same in informatica?
Tell me about MD5 functions in informatica
Hi, I want to change date type char value integer value? I tried alter table tab_name modify (newcolumn newdatetype). But The columns have 10 million values(char type) so I want to load now numeric data. How it is possible? Old Values New Value(I want to load numeric data but the old value should be there in the column) Y 1 N 0 ERROR at line 1: ORA-01439: column to be modified must be empty to change datatype Please help on this. Thanks, GM
How do you migrate data from one environment to another?
Suppose on 1st Nov 2010 you had created a mapping which includes huge aggregator calculations and it is under process for next two days. You will notice that even on 3rd day also its still calculating. So without changing a logic or changing a mapping How will you troubleshot or to run that mapping? Explain the steps