You're right it turned out that wasn't quit the solution I needed.
After some testing I was able to get it working with the following
command.
entries =
db(db.entries.user.belongs(db(db.event_users.event==event_id).select())).select(groupby=db.entries.user,
orderby=~db.entries.value)
I'm now trying to add a 2nd filter that says for this set of entries,
give me the ones that have a user_id equal to auth.user.id.
Thanks for the tips, I'll check it out.
On Nov 20, 4:30 pm, Cliff <[email protected]> wrote:
> If not working in the console, "print db._lastsql" will output the sql
> string to the terminal session where you started web2py, assuming you
> started it without the gui.
>
> Otherwise I think the gui has a little field to display outputs.
>
> On Nov 20, 3:42 pm, villas <[email protected]> wrote:
>
> > Hi Adrian
> > Good that you are making progress, even though it doesn't look like the
> > SQL would be equivalent to me.
> > However, just in case you didn't already know this tip, I have so often
> > found it useful to see what SQL statement is being generated by prefixing
> > '_' in front of select, eg
> > db(query)._select()
>
> > This prints the SQL to the console. However, you can of course also
> > easily put this into a variable and display the string in any view too.
> > Regards, D
>
>