No, I just didn't know the reason. Thanks for the explanation. sábado, 16 de Março de 2019 às 21:44:09 UTC, Anthony escreveu: > > On Saturday, March 16, 2019 at 3:06:07 PM UTC-4, João Matos wrote: >> >> Hello, >> >> I was checking the SQL statements used by web2py and found that the id >> field of a table is always added to the orderby when using a grid (didn't >> test in other forms). >> Even if the grid definition doesn't include a orderby argument, web2py >> always adds the ORDER BY id. >> >> Does anyone know why? >> > > Because of pagination, we need to ensure the database engine returns > records in the same order on every request, so their needs to be an ORDER > BY that guarantees a unique ordering of the records. It shouldn't hurt > anything, because if you add an explicit ORDER BY, the id field will be > added last, therefore only breaking ties based on the explicitly specified > fields. Is there any reason you want to get rid of the ordering? > > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

