Tuesday, July 1, 2014

Correlated inline view?

you can do like this



Select a,

b,

c,
[1] as val1,
[2] as val2,
[3] as val3,
..
from
(
Select a,

b,

c,

col1,
row_number() over (partition by a order by rundate desc) as seq

from table_1
)a
pivot (max(col1) for seq in ([1].[2],[3],...))p





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment