wtite sql query following table are
city gender no
chennai male 40
chennai female 35
bangalore male 10
bangalore female 25
mumbai female 15
i want the output?
city male female
chennai 40 35
bangalore 10 25
mumbai null 15
Answers were Sorted based on User's Feedback
Answer / santosh kumar sarangi
select city,max(decode(gender,'male',no)) as male,
max(decode(gender,'female',no)) as female from table_name
group by city
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / gagan
Suppose first table as test created below create table test
(
city varchar2(50),
gender varchar2(50),
nmbr varchar2(50)
)
and keep all data in it as mentioned and then try to run
this query...
select a.city, a.nmbr as male, b.nmbr as female
from test a, test b
where a.gender = 'male' and b.gender = 'female' and b.city
= a.city
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / gagan
Suppose first table as test created below...
create table test
(
city varchar2(50),
gender varchar2(50),
nmbr varchar2(50)
)
and keep all data in it as mentioned and then try to run
this query...
select a.city, a.nmbr as male, b.nmbr as female
from test a, test b
where a.gender = 'male' and b.gender = 'female' and b.city
= a.city
Is This Answer Correct ? | 0 Yes | 0 No |
What do mean by local and global repository?
How many joins in Informatica
What is the fact table?
how will you remove the duplicate records from flat file without using sorter?
What can we do to improve the performance of informatica aggregator transformation?
how the data will be loaded while desiging the schema?which one first (for e.g.-dimesions and facts)
Do joiner transformation use cache? If so describe?
What is the meaning of up gradation of repository?
i have to extract data from a flat file.the flat file has 10 records.i have to extract the 1st and 5th record every time.how is it done.
How do you remove duplicate records in informatica?
How do you join more than 3 flat files in informatica?
How do you take care of security using a repository manager