Help with query

39 views
Skip to first unread message

Pepe Araya

unread,
Mar 5, 2013, 12:30:50 PM3/5/13
to web...@googlegroups.com
Hi!

In words what i need is to get a set from this query: select the 'persons.email' and 'persons.id' from table 'persons' that are not in table 'invitations.to'

my tables:

db.define_table('persons',
 
Field('name'),
 
Field('email'))

db
.define_table('invitations',
 
Field('from',db.persons),
 
Field('to',db.persons))


Any help is welcome.

Thank you very much.

Anthony

unread,
Mar 5, 2013, 1:03:06 PM3/5/13
to web...@googlegroups.com
Check out .belongs() -- http://web2py.com/books/default/chapter/29/06#belongs.

Anthony

Derek

unread,
Mar 5, 2013, 2:18:15 PM3/5/13
to web...@googlegroups.com
You can negate a part of a query by using a tilde (~).

Pepe Araya

unread,
Mar 5, 2013, 2:20:26 PM3/5/13
to web...@googlegroups.com
Hi Derek and Anthony, 

that's make the trick!!

Thank you both!!

Pepe Araya
Diseñador / Designer



--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/OOFjQug73q0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Massimo Di Pierro

unread,
Mar 5, 2013, 5:49:20 PM3/5/13
to web...@googlegroups.com
Do not use to and from in field names. You will get into trouble. 
Reply all
Reply to author
Forward
0 new messages