write sql query following table
amount year quarter
1000 2003 first
2000 2003 second
3000 2003 third
4000 2003 fourth
5000 2004 first
6000 2004 second
7000 2004 third
8000 2004 fourth

i want the output
year q1_amount q2_amount q3_amount q4_amount
2003 1000 2000 3000 4000
2004 5000 6000 7000 8000



write sql query following table amount year quarter 1000 2003 first 2000 2003 ..

Answer / chanakya123

SELECT YEAR,
SUM(DECODE(QUARTER,'FIRST',AMOUNT)) Q1_AMOUNT ,
SUM(DECODE(QUARTER,'SECOND',AMOUNT)) Q2_AMOUNT,
SUM(DECODE(QUARTER,'THIRD',AMOUNT)) Q3_AMOUNT,
SUM(DECODE(QUARTER,'FOURTH',AMOUNT)) Q4_AMOUNT
FROM TABLE_NAME GROUP BY YEAR

Is This Answer Correct ?    9 Yes 0 No

Post New Answer

More Informatica Interview Questions

write a query following table bookid language 1234 english 1234 french 1234 spanish 1235 english i want the output are bookid lang1 lang2 lang3 1234 english french spanish 1235 english null null

1 Answers   TCS,


What is power center repository?

1 Answers  


how to create a sample mapping for dynamic lookup transformation

2 Answers  


How to convert flat file into xml file? How to tune joiner?

2 Answers   Accenture,


How to call stored Procedure from Workflow monitor in Informatica 7.1 version?

1 Answers   Accenture,






How to update records in Target, without using Update Strategy?

3 Answers  


how to we create datamart?

2 Answers   HSBC,


If we are using an aggregator but forget to mention the group by port .what will be the output??

11 Answers   Nomura, TCS,


What is the term PIPELINE in informatica ?

7 Answers   Deloitte,


Converting Rows to columns I have Relational source like his. JAN FEB MAR APR 100 200 300 400 500 600 700 800 900 100 200 300 I need to convert these rows into columns to the targe. MONTH TOTAL JAN 1500 FEB 900 MAR 1200 APR 1500 Please experts help me

8 Answers   HP,


i have a source table and 3 target table. when session runs first time-1st tgt second time-2nd tgt third time-3rd tgt fourth time-again 1st target. so no

4 Answers   HCL,


I've a denormalized table EMP(empno,ename,phone,addr1,addr2,fax,email). Now I want to insert the record into target in the format that, there will be 2 target rows for 1 source record. In target the row needs to be inserted as: ROW1: empno,ename,addr1,phone ROW2: empno,ename,addr2,fax,email And I'm not allowed to normalize transformation. How to achieve?

1 Answers   IBM,


Categories