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 |
Could anyone please mail me a copy of Informatica Certification Exam dumps to sandeep.nakka@gmail.com it would be appreciated if any one could help me out.
How to delete the (flat file) data in the target table after loaded.
what is shortcut in informatica? difference between shortcut,reusable object?
What is powercenter on grid?
source file name xyz a,0,a,a,a b,b,b,0,b c,c,c,0,c target should be like this xyz a b c how to implement this?
My source is this year 01/jun/2014 04/may/2015 09/mar/2017 my desired output is day month ye 01 jun 2014 04 may 2015 09 mar 2017 how do i acheive this
When do you use mapping parameters? (In which transformations)
What is a Shortcut and What is the difference between a Shortcut and a Reusable Transformation?
i have source like this ID 1 2 3 4 sal 1000 2000 3000 4000 and how to load target like this o_sal 1000 3000 6000 10000 can you plz give a sol using informatica
What is the default join that source qualifier provides?
what is the use of Java Transformation in Informatica 8.x?
explain the scenario for bulk loading and the normal loading option in Informatica Work flow manager ???