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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 counting comma-delimited values

Author  Topic 

stevep
Starting Member

17 Posts

Posted - 2001-10-16 : 08:47:46

How do you count unique values in fields that store comma-delimited values from HTML select form fields?

For example, with these values:

category
-----------------
1
1,2
2,4

How do you get the results:

category count
1 2
2 2
4 1

The obvious 'select category, count(category) from .. group by category', does not work because '1' and '1,2' are counted as two different categories.

help!




   

- Advertisement -