MySQL Forums
Forum List  »  PHP

Re: Using LIKE clause to find number in a comma-separated list
Posted by: Felix Geerinckx
Date: October 10, 2005 10:37AM

larry wrote:

> I have a database that stores lists of IDs in single column as a comma-separated list of ids. So
> a single field would have a list like this for example:
>
> "2,7,12,18,20,"
>
> I need to search this table for when a particular id shows up in any one of the records:

> I know this method of storing a list of IDs is not idea. But given that's what I have, any ideas how
> I could rewrite my SQL query?

SELECT * from my_table WHERE FIND_IN_SET('$id', my_id);

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: Using LIKE clause to find number in a comma-separated list
October 10, 2005 10:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.