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 / 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 |
how can u avoid duplicate rows in flat file?
suppose if we have dublicate records in a table temp n now i want to pass unique values to t1 n dublicat values to t2 in single mapping?how
Which transformation should u need while using the cobol sources as source defintions?
Hi can any one tell me the difference between persistence and dynamic caches? On which conditions we are using these caches?
Performance wise which is better joiner or look up ? Give me with example?
Please let me know how to do estimation before staring development in project. Here estimation in the sense how many associates are required, etc to complete the project.
What is sq transformation?
What is a pre-defined event and user-defined event?
How to merge First Name & Last Name?
Design a mapping to get the pervious row salary for the current row. If there is no pervious row exists for the current row, then the pervious row salary should be displayed as null.
WHAT IS THE DIFFERENCE BETWEEN .NET AND INFORMATICA?
Why do flat file load is faster if you compare that with table load ? Please answer me. Advance Thanks, Manojkumar