techcalgary@hotmail.com wrote:
> I have a table with a column that contains a comma seperated list of
> ids as TEXT that are used to reference multiple rows in another table.
> so "2,4" would reference id 2 and 4 in table2.
>
> select * from table2 where id = 3 or id = 4;
>
> Is there a way to do that without going through the list and
> delimiting with " or id = "? Something like
>
> select * from table2 where id in values(3,4);
>
> I thought I'd seen something like that before but I can't find it in
> the mysql manual.
>
> Is using a TEXT for an id list bad structure? Is there a better way to
> store an array of ids in a column in mysql?
>
Yes, this is a poor design. Google for "database normalization" for a
lot of good information.
When you have a relationship, you're generally better off creating a
third table with two columns - one for each id associated in the
relationship. Much more flexible.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================