write a query to follwoing table

amount year quarter
254556 2003 first
546332 2003 second
129034 2003 third
490223 2003 fourth
165768 2004 first
265443 2004 second
510412 2004 third
435690 2004 fourth

i want the output

year q1_amount q2_amount q3_amount q4_amount
2003 254556 546332 129034 490223
2004 165768 265443 510412 435690

Answer Posted / praveen hattikal

Select YEAR,SUM(q1_amt)q1_amt,SUM(q2_amt)q2_amt,SUM(q3_amt)
q3_amt,SUM(q4_amt)q4_amt from (
select YEAR,
Decode (QUARTER,'first',amount,0) as q1_amt,
Decode (QUARTER,'second',amount,0) as q2_amt,
Decode (QUARTER,'third',amount,0) as q3_amt,
Decode (QUARTER,'fourt',amount,0) as q4_amt
from table_name) group by YEAR

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Separate from an archive server and a powerhouse?

485


How can you generate reports in informatica?

569


In What Situations we can use MappingParameters ,Mapping Variables AND Session Parameters in REAL TIME.

1529


How to load a Dimension ? and how to load a fact table?

946


what is the -ve test case in your project.

1844






where to store informatica rejected data?

671


What is a difference between complete, stop and abort?

631


Plz can any one say me how to get the informatica certification materials and dumps

1590


Hi, I saw one mapping implemented by my seniors . In Expression transformation they implemented following logic. That is iif(is_date(in_UC_DATINV,'YYYYMMDD'),to_date(in_UC_DATINV,'Y YYYMMDD'),'Inventory Date is either invalid or null') Inventory_Date is validated only for is_date() But not validated for notisnull() . But error says “ either invalid or null “ why? Whether is_date() also check for not isnull() ? or in this logic something is different ? Please answer me . Advance thanks

1401


What is data transformation manager process?

615


What is a grid in Informatica?

604


Can I use same Persistent cache(X.Dat) for 2 sessions running parallely? If it is not possible why?If yes How?

1614


What is a mapplet/worklet in informatica?

678


What do you mean by filter transformation?

545


How can you define user defied event?

612