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 a query to follwoing table

amount year quarter
254556 2003 first
546332 2003 second
129034 2003 third
490223 2003 fourth
165768 2004 first
265443 2004 second
510412 2004 third
435690 2004 fourth

i want the output

year q1_amount q2_amount q3_amount q4_amount
2003 254556 546332 129034 490223
2004 165768 265443 510412 435690

Answer Posted / praveen hattikal

Select YEAR,SUM(q1_amt)q1_amt,SUM(q2_amt)q2_amt,SUM(q3_amt)
q3_amt,SUM(q4_amt)q4_amt from (
select YEAR,
Decode (QUARTER,'first',amount,0) as q1_amt,
Decode (QUARTER,'second',amount,0) as q2_amt,
Decode (QUARTER,'third',amount,0) as q3_amt,
Decode (QUARTER,'fourt',amount,0) as q4_amt
from table_name) group by YEAR

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Repository user profiles

1768


How to go to the older version for a mapping?

1103


How does a rank transform differ from aggregator transform functions max and min?

1213


Sequence generator, when you move from develoment to production how will you reset

2048


What is expression transformation?

1108


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

2041


Enterprise data warehouse your projects phase by phase explain?

1930


What is the use of transformation?

1002


Clarify the aggregator change?

1034


To Provide Support For Mainframes Source Data, which Files Are Used As A Source Definitions?

1113


what is diff b/t sorter t/r and agg have the option sorter property...

2183


What do think which one is the better joiner or look up?

1205


How do you load first and last records into target table? How many ways are there to do it? Explain through mapping flows.

1128


What is mapplet in informatica?

1065


what is size of u r database?

2311