csp_count = db.table.csp.count()
db(db.table).select(db.table.csp, '%s AS freq' % csp_count, groupby=db.table
.csp,
orderby=~csp_count, limitby=(start, end))
Within a given record, you should be able to access the count via
row[csp_count] or row.freq.
Anthony
On Thursday, April 27, 2017 at 6:00:17 AM UTC-4, Pierre wrote:
>
> Hi,
>
> Is there a way to transform this sql into a valid DAL expression ?
>
> "SELECT csp, COUNT(csp)AS freq FROM table GROUP BY csp ORDER BY COUNT(csp)
> DESC LIMIT %s OFFSET %s;" %(limit,offset)
>
>
> I want to avoid executesql as much as i can......
>
>
--
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/d/optout.