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
Answer Posted / 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 View All Answers
Why update strategy and union transformations are active? Explain with examples.
What is a repository manager?
Explain where to store informatica rejected data? How to extract the informatica rejected data?
Why filter transformation is an active one?
How do you update the records with or without using update strategy?
in reporting we add some new objects,how we get the count of the newly added objects to the report
How do you set a varible in incremental aggregation
What is Story point Estimation ? Can any one give just an introduction about this ? Advance Thanks
difference between repository database and repository service?
what is granularity,what type of granularity we will take in fact tables either lowlevel or highlevel,if two tables having same granularity that is posiable or not
What is target load order?
what are the fact table & dimensional table in pharmaceutical and hospotal related products???
what is the end to end process meaning in my project(my project is development)and functionality plz tell me
what is mean by complex business rule ?
What is event and what are the tasks related to it?