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 |
Hi 2 every one. i dont have real time experience, and please suggest me for following questions. a) we get the source data from what type of source systems? b) In banking domain project what are the FACT & DIMENTION tables please list out them? c) please write some colomn names in a table? Please reply for aboue questions?..... Thanks in advance.
What do you understand by a term domain?
What is workflow variable? When we use workflow variable? Can any one explain me with one example???
What is Test load plan? Let us assume 10 records in source, how many rows will be loaded into target?
Hello , I am unable to work with SQL transformation at least. Where do i need to give connection for sql transformaton ? At session level there is no property . I have created a SQL Transformation and chosen query mode. But do i need to pass connection information to it ? I don't know where do i need to write a query ? I have written a query in file and that file path i gave in the properties of SQL Transformation. But it is not working. Could any one of you please let know how can i work with SQL Transformation? Advance Thanks.
What is an expression transformation in informatica?
What is the Difference between sorter and aggregator?
After we make a folder shared can it be reversed?Why?
source is a flat file empname, empno, sal ram, 101, 1,000 sam, 102, 2,000 ques: my target needs the data to be loaded as sal -1000 and 2000 excluding commas target empname, empno, sal ram, 101, 1000 sam, 102, 2000 how to implement this?
in mapping i have one source and five targets in that data will be loaded into four targets properily in one target the data is not loaded how will u rectify
what is the diff b/w union and joiner and lookup?
If you done any modifications for a table in back end does it reflect in informatca warehouse or maping?