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
How many ways are there to do 'remove duplicate records in informatica'?
What is a passive transformation?
What happens when a session fails and you click on recover?
What are the components of Informatica? And what is the purpose of each?
Please let me know how to make Data masking in informatica..
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.
What is informatica?
Explain sessions. Explain how batches are used to combine executions?
How many ways a relational source definition can be updated and what are they?
Write the advantages of partitioning a session?
How to call shell scripts from informatica?
Define pmcmd command?
can u give example for factless fact table
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
Explain what are the different versions of informatica?