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

can anybady help me to achieve the aboue result by using informatica.

thanks in advance.

Answer Posted / qlikstar

Select year,
sum(case when quarter = 'first' then amount end) AS q1_amount,
sum(case when quarter = 'second' then amount end) AS q2_amount,
sum(case when quarter = 'third' then amount end) AS q3_amount,
sum(case when quarter = 'fourth' then amount end) AS q4_amount

from table
group by year order by year

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a sorter transformation?

783


Suppose on 1st Nov 2010 you had created a mapping which includes huge aggregator calculations and it is under process for next two days. You will notice that even on 3rd day also its still calculating. So without changing a logic or changing a mapping How will you troubleshot or to run that mapping? Explain the steps

1734


What is status code in informatica?

682


if i hv 6 table as source table but can i make 12 as a dim table and 6 as fact table belongs to that src table.

1879


What are data-driven sessions?

824






Which transformation is needed while using the Cobol sources as source definitions?

817


my source is junk data how will u remove that junk data by using unix please any one replay me

3356


To import the flat file definition into the designer where should the flat file be placed?

748


What is a pre-defined event and user-defined event?

669


How to convert multiple rows to single row (multiple columns) in informatica

1017


How to do the error handling of if ur source is flatfiles?

1604


3.how will u get information about bugs how will u rectify the bugs in realtime whch tool we are using to rectify the bugs

1845


What are the various test procedures used to check whether the data is loaded in the backend, performance of the mapping, and quality of the data loaded in informatica?

699


Why sorter is an active transformation?

840


whats the logic to load the lower level of granularity of data to fact table.

1911