yep, it's majorly borked. the fact that with sqlite it results in a correct query (but a totally unuseful resultset) shouldn't matter. I'm trying to figure out the best way to handle that in the code, but in my POV any query with a groupby should disable any editing in the grid.... how do you edit a row that is the result of an aggregated recordset ?
On Monday, August 5, 2013 11:17:04 AM UTC+2, villas wrote: > > This wasn't a 'real life' example, I was just trying to demonstrate that > some of the SQL doesn't seem to be valid. > It doesn't work if you specify the field either: > fields=[db.auth_user.first_name] > > The question is this: should it be possible to make such a SQLFORM.grid? > If so, how? > > > On Monday, 5 August 2013 09:54:08 UTC+1, Niphlod wrote: >> >> @all: you can't have a grid displaying all the fields of the auth_user >> table if you're grouping by first_name.... >> >> On Sunday, August 4, 2013 11:38:42 PM UTC+2, Massimo Di Pierro wrote: >>> >>> 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

