Which web2py version. This may be fixed in trunk. I see that ORDERBY is missing. I think that is the problem. Please check trunk and let us know. If still a problem, please open an issue.
On Sunday, 4 August 2013 15:13:48 UTC-5, villas wrote: > > I made a few tests but it appears that groupby produces buggy SQL when > used with grid, so I'm not sure what you can do there. Maybe someone else > could try it > > Here is a simple example: > > def testgrid(): > return dict(grid=SQLFORM.grid(db.auth_user, groupby=db.auth_user. > first_name,orderby=db.auth_user.first_name )) > > > > at one point sqlhtml.py produces this invalid SQL (for firebird): > > select count(*) from (SELECT count(*) FROM auth_user WHERE (auth_user.id > IS NOT > NULL) GROUP BY auth_user.first_name) > > Not sure what's going on, but it's not going to work like that... > > > On Sunday, 4 August 2013 06:11:01 UTC+1, Matt Grham wrote: >> >> Could be but I am trying to do it in SQLFORM.grid statement. How can I do >> that? >> >> On Saturday, August 3, 2013 4:04:40 PM UTC-7, villas wrote: >>> >>> For the example you provide, probably better with: distinct=True >>> That is the usual SQL method of suppressing duplicate rows. >>> >> -- --- 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.