This
rows = db(db.zoo.tier == 2).select()
is equivalent to
rows = db(db.zoo.tier.belongs([2])).select()
you can do
rows = db(db.zoo.tier.belongs([2, 3])).select()
On Thursday, 8 August 2013 14:28:47 UTC-5, dave wrote:
>
> I have two tables defined as follows
>
> db.define_table('animals',
> Field('type'),
> format='%(type)s')
>
> db.define_table('zoo',
> Field('name'),
> Field('tier', 'reference animals'),
> format='%(name)s'
> )
>
> field type is a column with values like, test 1, test 2, test 3
> now if I want to select all the records of table zoo with 'test 2' I can
> do something like this
>
> rows = db(db.zoo.tier == "2").select()
>
> but why can't I do something like
> db(db.zoo.tier.contains("2")).select() or
> pass a list ["2", "3"] to the contains operator to get all the records of
> "test 2" and "test 3"? can you suggest another way of implementing this?
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.