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
what is mean by complex business rule ?
How can we update a record in the target table without using update strategy?
Explain what are the different versions of informatica?
In warehouses how many schemas are there?
What is the commit type if you have a transaction control transformation in the mapping?
Explain what are the different types of transformation available in informatica.
How you know when to use a static cache and dynamic cache in lookup transformation?
what is SDLC way of code development?
What all join we can perform in LOOKUP transformation?
What are the main issues while working with flat files as source and as targets ?
What do you mean incremental aggregation?
Can we use the mapping parameters or variables created in one mapping into any other reusable transformation?
Explain the different kinds of facts.
What is Session and Batches?
Define Pmrep command?