PTS Posted August 16, 2007 Share Posted August 16, 2007 I run a sports team website that's heavily data drive. Two of my many tables are a "roster" table and a "news" table. One of the fields in the "news" table is playerRefID. If a particular "news" story is heavily about a player, I mark that field with the player's ID number from the "roster" table. I have no problem displaying news on just one particular player but I do have a problem if a story is about more than one players. The playersRefID field is a varchar field with numbers separate by commas if the "news" is about more than one player. For example, if a news story is about Player #11, Player #21 and Player #23, then in the news table, that playersRefID field would be '11,21,23' What statement would I use to SELECT if a particular player's ID is in that comma-separated "array"? If there even an option for this? If there a better option I should use? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/65283-selecting-from-a-column-where-a-number-appears-in-a-particular-fields-output/ Share on other sites More sharing options...
fenway Posted August 21, 2007 Share Posted August 21, 2007 The better option is to normalize you database and use a many-to-many relationship to link news and player IDs. Link to comment https://forums.phpfreaks.com/topic/65283-selecting-from-a-column-where-a-number-appears-in-a-particular-fields-output/#findComment-330383 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.