write sql query following table

quarter sales
q1 1000
q1 2000
q1 3000
q1 4000
q2 5000
q2 6000
q2 7000
q2 8000
q3 1000
q3 2000
q3 3000
q3 4000
q4 5000
q4 6000
q4 7000
q4 8000
i want the output format like
q1 q2 q3 q4
1000 5000 1000 5000
2000 6000 2000 6000
3000 7000 3000 7000
4000 8000 4000 8000

Answers were Sorted based on User's Feedback



write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / parthu

It may possible with Normalizer transformation.

Is This Answer Correct ?    1 Yes 0 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / letc

Using max function for q1,q2,q3,q4 in Aggregator transformation. Use sorter before aggregator

Is This Answer Correct ?    2 Yes 2 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / jj

without one more column its not possible i thing , it shoud
have prod or some thing

select prod,sum(q1),sum(q2),sum(q3),sum(q4) from (
select prod,(case when quarter='q1' then sal end) q1
,(case when quarter='q2' then sal end) q2
,(case when quarter='q3' then sal end) q3
,(case when quarter='q4' then sal end) q4 from za)
group by prod

Is This Answer Correct ?    1 Yes 1 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / ankit kansal

one solution can be like this


select max(q1) as q1,max(q2) as q2,max(q3) as q3,max(q4) as q4 from
(
select case when quarter = 'q1' then sales end q1
,case when quarter = 'q2' then sales end q2
,case when quarter = 'q3' then sales end q3
,case when quarter = 'q4' then sales end q4
,row_number() over ( partition by quarter order by 1 ) rnk

from sequel_test order by 5

)tb group by rnk order by 1,2,3,4

Is This Answer Correct ?    1 Yes 1 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / chandu

In Expression transfermation, if( sales = q1,sales,0)

Is This Answer Correct ?    1 Yes 13 No

Post New Answer

More Informatica Interview Questions

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?

0 Answers   Bosch,


performance wise which one is better in joiner and lookup transformation

2 Answers  


in staging we are merging the data and remove the inconsistants data that type of situation what u will done and type of functions u can use

0 Answers   TCS,


wat transf shud i use to achieve this id sal id sal sum src-1 20 tgt 1 20 40 1 20 1 20 40 2 15 2 15 35 2 20 2 20 35

2 Answers  


scenario: dept_no emp_nem 10 A, 10 B, 10 C, 10 D, 20 P, 20 Q, 20 R, 20 S output: dept_no emp_nem 10 A, 10 AB, 10 ABC, 10 ABCD, 20 ABCDP, 20 ABCDPQ, 20 ABCDPQR, 20 ABCDPQRS

1 Answers  






how do u move the code from development to production?

6 Answers  


What is the difference between writing a joiner query in ANSI style and THETA style?

0 Answers   TCS,


what is a time dimension? give an example?

2 Answers   IBM,


how i will stop my workflow after 10 errors

1 Answers   HP,


guys which is the best institute in banglore to learn informatica??

2 Answers  


How to extract the informatica rejected data?

0 Answers  


What is a code page?

0 Answers  


Categories