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

how we can load rejected record's at run time?(not through bad files)

0 Answers   TCS,


To provide support for Mainframes source data,which files r used as a COBOL files

1 Answers  


On lookup on any table we can get only a)any value or b)last value but if i need both duplicate values How can i achieve?

3 Answers  


what are the difference between Informatica 7.1 and 8.1?

6 Answers  


what is the significance of newlookup port in dynamic look up

1 Answers   IBM,


i want excute multiple sessions in one workflow using the "start task".what do i need to do?

2 Answers  


What is a difference between complete, stop and abort?

0 Answers  


what r the values tht r passed between informatics server and stored procedure?

1 Answers  


Can we insert and update a target table without using update strategy transformation?How?

4 Answers   Syntel,


Define mapplet?

0 Answers  


How to Display top 2 salaries for each department WITHOUT using Rank Transformation And WITHOUT using SQL queries in source qualifier.

3 Answers   Eureka Forbes,


how will compare two mappings in two different repository?

2 Answers   Real Time, TCS,


Categories