October 12, 2010 at 7:49 pm
Hi guys,
i have the following table
TABLE
N_1 N_2 N_3 N_4 Modes value
abcnull bcd cdeamazon321
acdnull bcd cdecircuits421
acdnull bcd cdecircuits221
abcnull bcd fegamazon234
abcnull bcd cdebetcel231
abcnull bcd cdecetcom521
abcdef null yuhgetcel 731
I need the output as
N_1 N_2 N_3 N_4 amazon circuits betcel cetcom getcel
abcnull bcdcde 321 ----------------------------------
acdnull bcdcde ------ 421,221------------------------
abcnull bcdfeg 234------------------------------------
abcnull bcdcde -------------- 231----------------
abcnull bcdcde ---------------------- 521---------
abcdef nullyuh ------------------------------ 731
Am working on Pivot but got to convert only 'distinct' modes as columns
am not sure of other way of working on it .
Also if all first five columns match then only one row is pulled out having value separating by comma(as you can see in 2nd row in the output)
Any ideas would greatly help.
thanks,
jon
October 12, 2010 at 8:49 pm
Please check out the two articles in my signature: CrossTabs and Pivot Tables, Parts 1 and 2. This should give you all the information you need for how to do this.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply