Web2py is actually guilty of performing this same operation, however instead
of commas, we use the pipe char '|'
The theory works like this
If you have the following
|1|23|4|55|15|
You can perform the following query to find the record with group id of 55
db(db.groups.like("%|55|%")).select()
This works as expected. However, in your case you have a problem. The fact
that the beginning and end of your
records don't wrap with a comma! So if you wanted to look for the group 1 in
your dataset... well it just wouldn't work. You can't do a like query on
"%1%" either, because that would also match if you have group 15. Dope.
Is it possible for you to run an update query on the table, and wrap every
record with a beginning and ending comma? If so, you can just use the simple
trick we use in web2py but use a comma instead of a pipe. Otherwise, you
might be better off attempting to re-design the system (you should at some
point anyways)
Hope that helps.
--
Thadeus
On Mon, Jul 19, 2010 at 5:16 AM, Snaky Love <[email protected]>wrote:
> any-to-many relation. For anybody interested: there is a book by
> Bill Karwin called "SQL Antipatterns" - he names the described design
> Jaywalking and it is the first antipattern in the book. I was
> surprised to find it in rea
>