I'm trying to get around the problem of not being able to do a join in the IS_IN_DB(). I've got the following, which I thought was working until I realized that it's using the id field from both tables. Can I alias a field from mol as id? (I don't need the actual id field from mol in this instance.)

allplaced = db(db.mol.removed==None).select()

Field('machine',db.machine, requires=IS_IN_DB(db(~db.machine.id.belongs(allplaced)), db.machine.id, '%(tag)s')),

Open to suggestions of a better way to do this.

I found that you can alias tables, but I couldn't make it alias the field as well, unless I just wasn't doing it wrong.

--
Andrew Thompson
http://aktzero.com/

Reply via email to