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 |
sateesh.sqldba
Starting Member
25 Posts |
Posted - 2010-07-16 : 13:37:43
|
Hi Experts, i have problem in grouping a single column likeCol1 Col2 Col31 img Data2 Img1 Data13 Img2 Data24 Img1,img2 Data35 Img,img1,img2 Data4when i used to group this usingcol2,count(*) from table where condition group by col2then result Col2 Groupingvalueimg 1Img1 1Img2 1Img1,img2 1Img,img1,img2 1but i need to display like thisCol1 Groupingvalueimg 2Img1 3Img2 3please help me outthanq inadvance sateesh |
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-07-16 : 14:14:17
|
you need to split the string to get each value in a separate column and then you can count and group. |
 |
|
sateesh.sqldba
Starting Member
25 Posts |
Posted - 2010-07-17 : 02:34:54
|
quote: Originally posted by slimt_slimt you need to split the string to get each value in a separate column and then you can count and group.
plz tel me how to split and count itsateesh |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-17 : 09:39:23
|
[code]select stringval, count(*)from table t cross apply CSVTable(t.col2)group by strval[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|