Please try a new version of web2py (I remember addressing a bug about
this in the past). if you still have a problem, try print the _select
and let us see the generate sql. This should definitively be possible.

Massimo


On Aug 6, 6:15 pm, howesc <how...@umich.edu> wrote:
> Hi all,
>
> I'm writing several queries with multiple tables, and left joins, and
> the generated SQL is not working with postgres:
>
> ProgrammingError: invalid reference to FROM-clause entry for table
> "concert"
> LINE 1: ..., artist LEFT JOIN audiofile ON
> audiofile.concert=concert.id...
>                                                              ^
> HINT:  There is an entry for table "concert", but it cannot be
> referenced from this part of the query.
>
> my query is:
>     query = db((db.concert_purchases.auth_user == auth.user.id) &
>                (db.concert.id == db.concert_purchases.concert) &
>                (db.concert_purchases.expires > now) &
>                (db.artist.id == db.concert.artist) &
>                (db.venue.id == db.concert.venue))
>     rows = query.select(db.concert.name, db.concert.id,
>                         db.concert_purchases.date,
>                         db.artist.name,
>                         db.venue.name,
>                         db.concert.date,
>                         db.audiofile.file,
>                         left=db.audiofile.on(db.audiofile.concert ==
> db.concert.id),
>                         orderby=~db.concert_purchases.date)
>
> I have web2py Version 1.63.5 (2009-06-03 23:35:00)
>
> so, is there a way i can write the query to make the left join work,
> or should i just do multiple queries?
>
> thanks for the help,
>
> christian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to