db.define_table('tableE',SQLField('name'))

db.define_table('tableA',SQLField('tableE',db.tableE),SQLField('name'))

condition=db.tableE.name.like('%o') ## records where name ends in 'o'
db.tableA.tableE.requires=IS_IN_DB(db(condition),'tableE.id','%
(name)s')


On Oct 17, 3:47 am, morningovermidnight <[EMAIL PROTECTED]>
wrote:
> Ok, here goes. I would like to add another table to my database and
> link it to an already exsisting table in my database. Lets say the
> existing table is table-E, and the table to add is table-A. Usually,
> adding a table with a foreign key reference to another table is no
> problem. But for this situation. I do not want every record from table-
> E to provide a foreign key to table-A. I only want a subset of the
> records from table-E to show up in table-A. How can I do this? I know
> I can get a subset of records from table-E with a query, but then how
> to add all the results of the query to table-A? And if a record is
> removed or altered in table-E, will those changes be reflected on
> related entries in table-A? Will the query be automatically updating?
> Can a database column be an SQL query?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to