On Tuesday, December 13, 2016 at 3:11:42 AM UTC-5, Scott Hunter wrote: > > The first 20 records appear in the same order in each case (using > DBBrowser). How does that help? >
The first and third SQL queries (that I listed, not from your original list) presumably are those from your print statements, and the second should be from the grid after you have clicked the f_Dog_ID column to sort on it. You claim in web2py your second print query and the grid query are the same as each other but different from the first print query, but in DBBrowser all three are the same. Is that correct? Note, in general, we should not expect your two print queries to yield the same order as each other or the grid query. The reason is that in the print queries, your "order by" clause does not specify a unique ordering of the records (since many records have the same value of f_Dog_ID). Only the grid query guarantees a consistent ordering of records, as it breaks any ties on f_Dog_ID by also including the "id" column in the "order by" clause. In web2py, if you add the "id" field to the orderby (i.e., orderby=db.t_dog.f_Dog_ID|db.t_dog.id) in your print statements, do you then get the same order as the grid? If not, perhaps you can post a minimal app that reproduces the problem. > > I *am* using the args (in code that appears before this), and do not use > any links generated by grid. > OK, but careful, if you ever do use any of the links in the grid, your current code won't work. Anthony > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.