Transpose of data

Database
Enthusiast

Transpose of data

Hi,

I have a data like this.

i/p:

year    Week                   Date               Type                Count

2015    5/15/2015           5/16/2015       New_Case          50

2015    5/15/2015           5/16/2015       Old_Case           60

My desired output is like this

o/p:

Year          Week              Date               Type                 Count            Type          Count

2015       5/15/2015        5/16/2015        New_Case          50                Old_case    60     

Any idea what can be done to do this. i have tried to look for unpivot, other posts on rows to columns, but couldn't find a solution

Thanks !

Samir

3 REPLIES
Enthusiast

Re: Transpose of data

Hi, 

Could someone look into this ? No replies to this post yet :(

--Samir

Enthusiast

Re: Transpose of data

If your using TD 14 and above, use TDSTATS.UDFCONCAT for transpose column to row

select year, week, date, type, tdstats.udfconcat(count)) from table_name;

Thanks!!

Enthusiast

Re: Transpose of data

I am trying to get access to udfconcat for a number of projects. One question: How does it determine the sort order for the concatenated string?

Thanks,

Kevin