Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



write sql query following table amount year quarter 1000 2003 first 2000 2003 ..

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

write sql query following table amount year quarter 1000 2003 first 2000 2003 ..

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

write sql query following table amount year quarter 1000 2003 first 2000 2003 ..

Answer / qlikstar

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

write sql query following table amount year quarter 1000 2003 first 2000 2003 ..

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

write sql query following table amount year quarter 1000 2003 first 2000 2003 ..

Answer / kamleshmishra291

SQL OVERRIDE :
SELECT * FROM TABLE_NAME PIVOT(MAX(AMOUNT) FOR QUARTER IN ('FIRST','SECOND','THIRD','FOURTH'));

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Informatica Interview Questions

i have two tables,table 1 having 2 columns and 3 rows,table2 having 3 columns and 2 rows.what is the output if i do left outerjoin,full outer join,right outer join?

2 Answers   IBM, Polaris,


HOW CAN U FIND THE SESSION START TIME? chandumba2005@gmai.com

2 Answers   TCS,


write a query following source region sales 1 1000 2 2000 i want the output ?please give solution 1 2 1000 2000

8 Answers   TCS,


How to extract the informatica rejected data?

0 Answers  


hi all hi have flat file like below my requirement is empid,ename,sal,loc 101,vamshi,5000,hyd 101,vamshi,5020,hyd 201,raju,5000,hyd 202,ram,4000,hyd 203,kumar,3500,pune 203,kumar,3500,pune 203,kumar,5000,hyd 203,kumar,6000,hyd i want the o/p like this in one target 201,raju,5000,hyd 202,ram,4000,hyd and in second target 101,vamshi,5000,hyd 101,vamshi,5020,hyd 203,kumar,3500,pune 203,kumar,3500,pune 203,kumar,5000,hyd 203,kumar,6000,hyd

9 Answers   IBM,


Tell me about your experience in informatica? what is best mark you can give yourself? How to answer this question?

0 Answers   HCL,


What is a look up function? What is default transformation for the look up function?

2 Answers   ASM, TCS,


If there are 3 workflows are running and if 1st workflow fails then how could we start 2nd workflow or if 2nd workflow fails how could we start 3rd workflow?

4 Answers   TCS,


How the dimensions will be loaded?

0 Answers   HCL,


case and like function in informtica (my source is XML). case when OS Like'%Windows%' and OS Like '%200%' then 'Windows 200' case when OS Like'%Windows%' and OS Like '%200%'and OS like '%64%' then 'windows 200 64 bit' etc.,,

1 Answers  


Difference between Data and Index Caches?

0 Answers   Informatica,


I need an oracle query for convert Char to Integer?. Can any one help me how to do this?

3 Answers  


Categories