Il 07/07/15 21:15, Dave S ha scritto:
>
>
> On Tuesday, July 7, 2015 at 8:15:08 AM UTC-7, pjryan126 wrote:
>
>     Why not make it Field('date_updated', 'datetime',
>     default=request.now, update=request.now) and then search on
>     date_updated only?
>
>
> Jumping in, let me say that I like this.  For rows that haven't been
> updated since they were created, this will give those fields the same
> value.
>
> I can see, however, that someone might also want to know what their
> oldest row is, even if it updated recently.  Probably best done be
> searching only date_created.
Just a thought... date_created <= date_updated so if you want the
minimum of the two columns just look inside the first, if you want the
maximum just look inside the second. Am I wrong?

    M.
>
> /dps
>
>  
>
>
>     On Tuesday, July 7, 2015 at 9:04:21 AM UTC-4, lyn2py wrote:
>
>         Hi,
>
>         If I have 2 columns, date_created, date_updated
>
>         |
>         db.define_table('table', 
>             Field('date_created', 'datetime',default=request.now),
>             Field('date_updated', 'datetime',update=request.now),
>         )
>         |
>
>         and I want to do a DAL query to get the datetime that is the
>         furthest from now (i.e. the db entry is the oldest) on both
>         the date_created and date_updated. I know how to do it if it's
>         just one column by following the example here
>         
> (http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum--avg--min--max-and-len
>         
> <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum--avg--min--max-and-len>),
>         but how should I do this if two columns are involved?
>
>
> -- 
> 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]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.

Reply via email to