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! Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.