write a query to follwoing table
amount year quarter
254556 2003 first
546332 2003 second
129034 2003 third
490223 2003 fourth
165768 2004 first
265443 2004 second
510412 2004 third
435690 2004 fourth
i want the output
year q1_amount q2_amount q3_amount q4_amount
2003 254556 546332 129034 490223
2004 165768 265443 510412 435690
Answer Posted / ankit kansal
The above answer is perfectly fine, however you can achieve the same using case
Select YEAR,SUM(q1_amt)q1_amt,SUM(q2_amt)q2_amt,SUM(q3_amt)
q3_amt,SUM(q4_amt)q4_amt from (
select YEAR,
CASE QUARTER WHEN 'first' THEN amount ELSE 0 END as q1_amt,
CASE QUARTER WHEN 'second' THEN amount ELSE 0 END as q2_amt,
CASE QUARTER WHEN 'third' THEN amount ELSE 0 END as q3_amt,
CASE QUARTER WHEN 'fourth' THEN amount ELSE 0 END as q4_amt
from t_name) temp group by YEAR;
http://deepinopensource.blogspot.in/
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
State the limitations where we cannot use joiner in the mapping pipeline?
What is lookup transformation?
What can we do to improve the performance of informatica aggregator transformation?
How to update or delete the rows in a target, which do not have key fields?
Debugger what are the modules, what are the options you can specify when using debugger, can you change the expression condition dynamically when the debugger is running.
As union transformation gives UNION ALL output, how you will get the UNION output?
What is a sequence generator transformation?
what is the size of u r source(like file or table)?
How do you remove duplicate records in informatica? And how many ways are there to do it?
what is size of u r database?
Can I use same Persistent cache(X.Dat) for 2 sessions running parallely? If it is not possible why?If yes How?
Why update strategy and union transformations are active? Explain with examples.
Write the unconnected lookup syntax?
What is the difference between a repository server and a powerhouse?
Hi Everybody, I have one fixed width file as source and 4 oracle tables (relational) as target. What are the Unit test cases i need to implement ? 1.Using TextPad software i tested postion of the field 2.As per specification i tested like whether it is correctly mapped or not? Is there any other test case do i need to implement. If possible can any one give me the test cases Advance Thanks