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 |
Dovelopment work (mapings,workflows)and unit testing also done in informatica ,then wt we do ? pls give me detail?
what is mapping parameter and mapping variables
how we can do session partition in informatica any one explain me clearly? thanks advance.
Define informatica repository?
how did u understand business requirement?
I want load the data into target with out 1st and last record.
what is shared lookup&persistent lookup?
4 Answers Accenture, Cap Gemini,
i have one senario i have table with 2columns one for primary key another is a constant value(zero). i have to lookup the table and get the maximum primary key here i don't have any common column between source and lookup table(wt table i explained above)... table is (i am assuming he didn't give the table) column1 column2 5 0 2 0 8 0 6 0 3 0 12 0 7 0
how we can add header and footer to flat files?
2 Answers Tech Mahindra, Zensar,
How is Source Side push down optimization different to just providing a SQL override in Source qualifier transformation.
WAT IS TEXT LOAD?
What is the use of incremental aggregation?