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

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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many ways are there to do 'remove duplicate records in informatica'?

1015


What is a passive transformation?

1105


What happens when a session fails and you click on recover?

1120


What are the components of Informatica? And what is the purpose of each?

1055


Please let me know how to make Data masking in informatica..

1726


I have two different source structure tables, but I want to load into single target table? How do I go about it? Explain in detail through mapping flow.

1167


What is informatica?

1156


Explain sessions. Explain how batches are used to combine executions?

1034


How many ways a relational source definition can be updated and what are they?

1018


Write the advantages of partitioning a session?

1282


How to call shell scripts from informatica?

999


Define pmcmd command?

1047


can u give example for factless fact table

6651


how will u take the data from clint server and next what u do in datamodeling what u will u do in staging area what u will u do next what u are doing please give the step by step by process

2160


Explain what are the different versions of informatica?

1099