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
Answers were Sorted based on User's Feedback
Answer / venky
select city,sum(c1) male,sum(c2) female from(select
city,decode(gender,'male',no,0)
c1,decode(gender,'female',no,0) c2 from tablename) tablename
group by city;
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / 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 |
Answer / anshita gupta
select * from city pivot(max(no) for gender in('male ','female'));
Is This Answer Correct ? | 0 Yes | 0 No |
Plz can any one say me how to get the informatica certification materials and dumps
how to load first record of first time run,second record to 2nd time n 3rd record from 3rd time to target table
Hello...... How can i set my mapping as read-only? Please answer me. Advance thanks
what is the method of error handling when session is running?
i have a source table ID NAME SAL 101 A 1000 102 B 2000 103 C 1500 target load should be ID NAME SAL 101 A 1000 101 B 2000 101 C 1500 102 A 1000 102 B 2000 102 C 1500 103 A 1000 103 B 2000 103 C 1500
When will you use SQL override in a lookup transformation?
How to fix the etl bugs..Tell me the process?
What is IQD file?
Suppose we have a (assume relational) source table Product_Id Month Sales 1 Jan x 1 Feb x . . . . . . 1 Dec x 2 Jan x 2 Feb x . . . . . . 2 Dec x 3 Jan x 3 Feb x . . . . . . 3 Dec x . . . . . . and so on. Assume that there could be any number of product keys and for each product key the sales figures (denoted by 'x' are stored for each of the 12 months from Jan to Dec). So we want the result in the target table in the following form. Product_id Jan Feb March.. Dec 1 x x x x 2 x x x x 3 x x x x . . So how will you design the ETL mapping for this case , explain in temrs of transformations.
TWO FLAT FILES ARE THERE , EACH HAVING NO MATCHING COLUMNS . HOW CAN U JOIN THESE TWO USING JOINER TRANSFORMATION ?
Hi, Can someone send me the DWH and Informatica FAQ's at vanibv6@gmail.com Thanks in Advance, Vani
what is metadata?