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 / praveen hattikal
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,
Decode (QUARTER,'first',amount,0) as q1_amt,
Decode (QUARTER,'second',amount,0) as q2_amt,
Decode (QUARTER,'third',amount,0) as q3_amt,
Decode (QUARTER,'fourt',amount,0) as q4_amt
from table_name) group by YEAR
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
I have done MBA in 2008. i got job as business analyst in 2008 january through consultany. but after 3 months they are giving training Informatica developer. now iam continuing this job. my question is when iam going to interview HR people ask me many times like this " YOU ARE MBA GRADUATE. HOW YOU ARE SELECT THIS POSTION. IAM EXPLAINING WHAT I HAVE MENTION ABOVE". PLEASE TELL HOW IAM TELLING THIS QUESTION ANSWER.
Write the prerequisite tasks to achieve the session partition?
What is the benefit of partitioning a session?
What is the difference between source qualifier transformations source filter to filter transformation?
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.
Enterprise data warehouse your projects phase by phase explain?
What are the types of caches in lookup? Explain them.
Different qualification between a related rotate toward the sky and isolates look upward?
Describe the impact of several join conditions and join order in a joiner transformation?
What is a pre-defined event and user-defined event?
What is a sequence generator transformation?
What is Session and Batches?
WHAT IS EDM?WHAT IS THE USE IN INFORMATICA? chandumba2005@gmai.com
5. Consider the following products data which contain duplicate rows. A B C C B D B Q1. Design a mapping to load all unique products in one table and the duplicate rows in another table. The first table should contain the following output A D The second target should contain the following output B B B C C
what are factless facts? And in which scenario will you use such kinds of fact tables.