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
can anybady help me to achieve the aboue result by using informatica.
thanks in advance.
Answers were Sorted based on User's Feedback
Answer / hari
select * from (select year,
max(amount,quarter='first') q1_amount,
max(amount,quarter='second') q3_amount,
max(amount,quarter='third') q4_amount,
max(amount,quarter='fourth') q4_amount
from table_name group by year );
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ankit kansal
One way of doing it is simple using aggregate function.
select year,sum(case when quarter='first' then amount end) as q1_amount
,sum(case when quarter='second' then amount end) as q2_amount
,sum(case when quarter='third' then amount end) as q3_amount
,sum(case when quarter='fourth' then amount end) as q4_amount from test group by year;
http://deepinopensource.blogspot.in/
Is This Answer Correct ? | 1 Yes | 0 No |
Select year,
sum(case when quarter = 'first' then amount end) AS q1_amount,
sum(case when quarter = 'second' then amount end) AS q2_amount,
sum(case when quarter = 'third' then amount end) AS q3_amount,
sum(case when quarter = 'fourth' then amount end) AS q4_amount
from table
group by year order by year
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ankit kansal
on my previous answer i had given a solution using SQL query now i will give you using informatica.
1) Take Expression and create three four output ports.
(i) q1 o IIF(quater='first',amount,0)
--same for q2,q3,q4
2)In Next step use a AGG Trans.
(i) Again create four ports with group by on Year column
q1_amount sum(q1)
q2_amount sum(q2) ..
--same for q3 and q4
http://deepinopensource.blogspot.in/
Is This Answer Correct ? | 0 Yes | 0 No |
SQL OVERRIDE :
SELECT * FROM TABLE_NAME PIVOT(MAX(AMOUNT) FOR QUARTER IN ('FIRST','SECOND','THIRD','FOURTH'));
Is This Answer Correct ? | 0 Yes | 0 No |
Explain one complecated mapping?
can you use flat file for repository?why?
what are the reusable tasks in informatica ?
11 Answers CTS, HP, IBM, TCS,
i have a source table and 3 target table. when session runs first time-1st tgt second time-2nd tgt third time-3rd tgt fourth time-again 1st target. so no
I am hvaing SOURCE as first line: 1000,null,null,null second line as:null,2000,null,null 3rd line as :null,null,3000,null and final line as: null,null,null,4000 ............................Now i want the OUTPUT as 1000,2000,3000,4000 For more clarification i want to elimate nulls and want in a single line. Please help me out
without using rank transformation how can we rank items by using some other transformations
wt is inline view? when and why we Use ?mail to rayallarv@gmail.com
1)you have multiple source system where u receive files ,how do you actually load into mapping using transformation,what are the transformation you use? 2)you have files in ftp location ,how do you get it into mapping with you ETL concept?
Write a query to display Which deptno is containing highest Sal > avg (sum (Sal)) of all deptno; Avg (sum (Sal)) o f all deptno= 9675 Deptno, sum (Sal) 10 8750 20 10875 30 9400
Please let me know how to make encryption and decryption with example?
1)can anyone explain how to use Normalizer transformation for the following scenario Source table | Target Table | Std_name ENG MAT ART | Subject Ramesh Himesh Mahesh Ramesh 68 82 78 | ENG 68 73 81 Himesh 73 87 89 | MAT 82 87 79 Mahesh 81 79 64 | ART 78 89 64 | please explain what should be the normalizer column(s) The GCID column 2)Also please explain the Ni-or-1 rule.
5 Answers FCS, IBM, Satyam, TCS,
what are challenges that you faced in testing? give solution to it?