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

Answer Posted / chanakya123

SELECT YEAR,
SUM(DECODE(QUARTER,'FIRST',AMOUNT)) Q1_AMOUNT ,
SUM(DECODE(QUARTER,'SECOND',AMOUNT)) Q2_AMOUNT,
SUM(DECODE(QUARTER,'THIRD',AMOUNT)) Q3_AMOUNT,
SUM(DECODE(QUARTER,'FOURTH',AMOUNT)) Q4_AMOUNT
FROM TABLE_NAME GROUP BY YEAR

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is mean by complex business rule ?

2144


How can we update a record in the target table without using update strategy?

1120


Explain what are the different versions of informatica?

1080


In warehouses how many schemas are there?

1056


What is the commit type if you have a transaction control transformation in the mapping?

1017


Explain what are the different types of transformation available in informatica.

1118


How you know when to use a static cache and dynamic cache in lookup transformation?

1836


what is SDLC way of code development?

2018


What all join we can perform in LOOKUP transformation?

953


What are the main issues while working with flat files as source and as targets ?

1138


What do you mean incremental aggregation?

1052


Can we use the mapping parameters or variables created in one mapping into any other reusable transformation?

1261


Explain the different kinds of facts.

970


What is Session and Batches?

1084


Define Pmrep command?

1030