>
> person = db(db.person.name='....').select().first()
>> papers = db.paper.authors.contains(person.id).select()
>>
>
> Sorry, I didn't read carefully enough. That's not what I need, I need to 
perform a join. My real-world query is rather like:

db.define_table('person',
    Field('name', unique=True),
    Field('some_field'),
    )
    
Advisor     = db.person.with_alias('advisor')
GradStudent = db.person.with_alias('grad')

db.define_table('thesis_project',
    Field('advisors', 'list:reference person'),
    Field('candidate', db.person),
    Field('title', 'text')
    )



and then:

db( db.thesis_project.advisors.contains(Advisor.id) & 
   (db.thesis_project.candidate==GradStudent.id) & 
   (Advisor.some_field==some_value) & 
   (GradStudent.some_field==some_value)).select(...)



and it works in mysql using INSTR and CONCAT, and there are other solutions 
with other functions that don't seem to work in sqlite, even though some of 
them are advertised. That's my puzzle.


-- 



Reply via email to