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 |
which is better perfomancewise lookup or joiner and why?can anyone give example?
How to display last 5 records in a table ? With out Top key word and doing order by desc Advance thanks
What is informatica etl tool?
How is Source Side push down optimization different to just providing a SQL override in Source qualifier transformation.
Describe an informatica powercenter?
i have flatfile source. i want to load the maximum salary of each deptno into target. what isthe mapping flow
Hi, I am new to Informatica, What is a flat file and how to use flat file in infomratica please help me.
when i try to connect to the repository server i am getting this message can someone help me.. Starting Repository [infa_rep] (6016|1292) Informatica Repository Agent, version [7.1.1], build [0811], 32-bit. (6016|1292) Copyright (c) 2000-2004 Informatica Corporation. All Rights Reserved. This Software is protected by U.S. Patent Numbers 6,208,990; 6,044,374; 6,014,670; 6,032,158; 5,794,246; 6,339,775 and other U.S. Patents Pending. (6016|1292) Informatica Repository Agent starting up. (6016|1292) Security audit trail has been turned off. (6016|1292) infa_rep: Repository runtime manager initialized. (6016|1292) infa_rep: Initialized configuration information. (6016|1292) infa_rep: Initialized request dispatcher. (6016|1292) Database Connection Error : Failed to logon to Database server ORA-12154: TNS:could not resolve service name Database driver error... Function Name : Connect Database Error: Failed to connect to database using user [] and connection string []. (6016|1292) Service stopped.
What is aggregate cache in aggregator transforamtion?
Can you copy the session to a different folder or repository?
Stage is which type of load is it a full load or incremental load Please let me know in detail with best example
my source is junk data how will u remove that junk data by using unix please any one replay me