On 26/07/2011 11:18, Manuele Pesenti wrote:
can you help me to translate this sql query that correctly runs under my
mysql server?

maybe it's better to say what here is needed... suppose to have the subsequent model:

db.define_table('site',
    Field('name'),
    ...
)

db.define_table('curve',
    Field('start', 'date'),
    Field('site', db.site, requires=IS_IN_DB(db, 'site.id')),
    ...
)

I would like to extract a join from the two table with the condition db.curve.site==db.site.id (simple one to many relationship) in wich only the last 'curve' record is represented (i.e. start is max) for EACH site... so I need ALL the last record of the curve table associated with the corresponding site description (i.e. fields)

thank you very mutch


        Manuele

Reply via email to