> where does this kind of thing happen with web2py? Could you please > specify what exactly are you writing about here? Does this mean the > web2py database abstraction layer produces this kind of hackery > instead of intersection tables on a many-2-many relation?
Consider the following schema. db.define_table('groups', Field('name')) db.define_table('accounts', Field('name'), Field('group_id', db.groups, requires=IS_IN_DB(db, 'groups.id', ' groups.name', multiple=True) ) In this case, what web2py actually does is create a string field (because you specified multiple = True), and then when you insert a record using SQLFORM, it will automatically parse the multiple checkboxes into the jaywalking trick. Its stupid, thats another reason to add to my very long list of dislikes for SQLFORM and how web2py couples these things together. I would much rather a Field('group_id', db.groups, manytomany=True) type that the DAL would handle automatically for me... but that is getting into ORM space, so the right thing to do is to handle many to many relationships manually. That is all fine and dandy, back to the problem at hand. I'm afraid though that anything will be hacky because of the design flaw. Hopefully there are no spaces in the data? You might have to do something such as I want record 5 out of the following set 5,55,32,12,16,15 Well, I need to look for a single 5 that could appear at the beginning of the string, the end of the string, or somewhere in the middle of the comma separated values... nasty, but it might look something like this: db((db.groups.like('5,%')) | (db.groups.like(',5%') | (db.groups.like('%,5,%')).select() This won't be fast though. You won't be happy with the performance in speed. BUT it will work. -- Thadeus On Mon, Jul 19, 2010 at 6:45 AM, Snaky Love <snakyl...@googlemail.com>wrote: > where does this kind of thing happen with web2py? Could you please > specify what exactly are you writing about here? Does this mean the > web2py database abstraction layer produces this kind of hackery > instead of intersection tables on a many-2-many relation? >