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 $$$$?
Repository user profiles
What is a rank transform?
How does a sorter cache works?
Explain the tuning lookup transformation - informatica
What are the types of caches in lookup?
What are the various types of transformation?
Differentiate between a repository server and a powerhouse?
What are the different types of transformation available in informatica.
Source and Target are flat files, Source table is as below ID,NAME 1,X 1,X 2,Y 2,Y On Target flat file i want the data to be loaded as mentioned below ID,NAME,REPEAT 1,X,2 1,X,2 2,Y,2 2,Y,2 How to achieve this, Can i get a map structure
How do you update the records with or without using update strategy?
What is the status code in stored procedure transformation?
i have a data in my source as a flat files what test i have to perform the next step can any body help to me
What are batches?
Design a mapping to load the cumulative sum of salaries of employees into target table?