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 is powercenter on grid?
Q. source having mutile depatment of data, dept1, dept2 ....dept10 today. we have mutilple depts in source, we need to generate dept1, dept2 and multile files in target side. today we have 10 dept which have 10 files, tommorow we have only 4 dept and 4 files, dayafter tommorow we have only 6 all the number of files in the targete file directory it's always dynamic. how can acheive it.
Suppose we do not group by on any ports of the aggregator what will be the output?
How the Informatica Server reads perameter file?
how can u load the data in time dimension?
What are the designer tools for creating tranformations?
For stage table data processing, suppose in first run we processed 8 records out of 10 records then in 2nd run we should consider only not processed records (here total no of records =2) along with new records which got loaded in stage table thru real time mapping. Note : In this example, 8 records are those records for which we got transaction number after lookup on trn_no_cod table and 2 records for which lookup returns trn_no as NULL
How to extract original records at one target & Duplicate records at one target? {with out using EXPRESION transformation and sequence generator transformation?}<-this is important
explain abt union t/r?
In a sequential batch can you run the session if previous session fails?
Hi experts ,I have a Source of 1000 records.I have to load 100 records in first target,101 to 200 records in 2nd target, 201 to 300 records in 3rd target and again 301 to 400 in first target like that as cyclick process. How can i acheive this.
Can yoU use the maping parameters or variables created in one maping into another maping?