Hi Richard -- Well, it wasn't the solution I was originally thinking of, but you clued me into the solution that works. I used "executesql" and a big 'ol triple-quoted SQL string to get the query working. And the surprise (for me) was how easy it was to get the output into a Rows object where I could use the power of web2py to format the output for my view.
The DAL is amazing and very broad in what it covers, but there are just certain corner-cases of SQL which will always elude it. I've decided that's a good thing. Software systems that try to do *everything* in a new paradigm tend to become so bloated with corner-cases that they lose their way. Our little web2py has such sparse beauty it would be a shame to see it try to turn into "SQL part deux". Thanks for your help and for spending some of your thought-photons on my problem. -- Joe B. On Tuesday, February 18, 2014 6:59:45 AM UTC-8, Richard wrote: > > So... You seem to be ready for a stored procedure... Or you need to > thought to your problem into more then one step, maybe having a view for > the sub query... > > I was to porpose the multiple subquery, since your query is already slow, > I would try this option, just to see if it couldn't be a bit faster... > > For slow query that for which I don't want to invest more time to create a > function or stored procedure, I generally create a view and cache it with > web2py... > > Richard > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

