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
 SQL Server Development (2000)
 How Can You Select Distinct Comma-Delimited Terms In A Field Of A Table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-29 : 15:36:06
Evan writes "I Have a Table called 'films'.
There is a field in it called 'Genre'.

I need a way to Query the table for the distinct terms that are comma-delimited in a field for each row in the table.

For instance:

Because data was entered with a drop down menu with multiple selections turned on, the results of three records (or rows) might be as follows:

Adventure, Cartoon, Drama
Adventure, Cartoon
Cartoon

Now, how do I create a recordset containing only the distinct terms in each row's field? The output I would expect would be as follows:

Results (3 row RecordSet):
Adventure
Cartoon
Drama

So although we have a total of 6 terms throughout the original 3 records, the results of the query would return a recordset containing only the 3 distinct terms within the 6 terms.

Any ideas?

Thanks,

Evan"
   

- Advertisement -