Let's consider following tables:
db.define_table('users', SQLField('name'))
id1=db.users.insert(name='user A')
id2=db.users.insert(name='user B')
db.define_table('jobs',
SQLField('description'),
SQLField('user1',db.users),
SQLField('user2',db.users))
db.jobs.user1.requires=IS_IN_DB(db,'users.id','%(name)s')
db.jobs.user2.requires=IS_IN_DB(db,'users.id','%(name)s')
db.jobs.insert(description='some job to do', user1=id1, user2=id2)
Simple query like this will give me name of user1:
db(db.jobs.user1==db.users.id).select(db.jobs.description,
db.users.name)
Question: how to make query to show 'description' from table 'jobs'
together with names of the 2 users taken from table users?
something like: jobs.description user1.name user2.name
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---