Thanks for a great framework. I'm loving web2py, but I just encountered a 
difficult query

One query generates a list of people.
Each of those persons has 0 to many reports filed about them.
I wanted to see only the newest report on each person AND I want to see 
Null or None if no reports have been filed.

This query almost works:

foo = db(db.benchmark_targets.benchmark == 
for_benchmark.id).select(left=db.lobby_report.on(db.lobby_report.KPID == 
db.benchmark_targets.KPID), orderby=~db.lobby_report.datetime)

but a person is listed twice if they have multiple reports filed about 
them.  If I add a groupby to the query it shows the right report but only 
people with reports filed (does not show people with 0 matching reports).

How do I see only the newest report Left outer joined to a group of people?

Thanks in advance for your help.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to