mishasoni Posted March 9, 2009 Share Posted March 9, 2009 I am somewhat new to php and am in need of some assistance. I have a mysql table ("Library") with a field called "Tags" that contains a list of comma-separated words that function as tags/categories for a series of publications. There is a finite number of total tag words, many of which are repeated across records. I need to select only distinct tags words in order to display a list of available tags/categories. So using SELECT DISTINCT Tags FROM Library WHERE Tags IS NOT NULL does not work as this selects distinct field values, not distinct strings within a field. Can anyone help me out with what the query would look like to select distinct comma-separated words within a field? I'm desperate! Link to comment https://forums.phpfreaks.com/topic/148670-selecting-distinct-comma-separated-values-from-a-column/ Share on other sites More sharing options...
corbin Posted March 9, 2009 Share Posted March 9, 2009 It would probably be possible, but the complexity of the query, and the performance issues it would have would be terrible. Why not store tags in rows instead of a CSL? Example: CREATE TABLE tag_video ( video_id int, tag varchar(255) ); Link to comment https://forums.phpfreaks.com/topic/148670-selecting-distinct-comma-separated-values-from-a-column/#findComment-780696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.