Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kaus
Posting Yak Master
179 Posts |
Posted - 2003-03-28 : 12:44:07
|
| I'm trying to do very similar to Rob Volks crosstab procedure, but hoping to in someway use aggregate function on a varchar -- am I out of luck ??table is:proj_code(int) chapter(int) desc(varchar)1 8 6150(b)1 8 6150(c)2 3 6152(d)2 8 6150(b)I'm pivoting on chapter, but want to append the desc -- separate values with commas or similarproj_code chapter8 chapter31 6150(b), 6150(c)2 6150(b) 6152(d)ThanksPete |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-03-28 : 12:50:01
|
| Just substitute the SUM() with MAX() and the 0's with NULLs ....i.e.,SUM(CASE WHEN col=1 then value else 0 END) as Col1becomes:MAX(CASE when col=1 then TextValue else Null END) as Col1- Jeff |
 |
|
|
kaus
Posting Yak Master
179 Posts |
Posted - 2003-03-28 : 13:22:18
|
| I'm running this on above table:exec crosstab 'select project_code from prop15 group by project_code', 'MAX(CASE when desc=1 then desc else Null END) as desc', 'Chapter', 'prop50'getting error:Incorrect syntax near ')' |
 |
|
|
kaus
Posting Yak Master
179 Posts |
Posted - 2003-03-28 : 16:18:22
|
| problem solved |
 |
|
|
|
|
|