Can you try

s=(db.mytable.notified.year() | db.mytable.notified.month() | 
db.mytable.notified.day())
rows = db(...).select(s, db.mytable.id.count(),groupby=s,orderby=s)


On Wednesday, 6 June 2012 00:14:38 UTC-5, weheh wrote:
>
> I have db.define_table('mytable', ..., Field('notified', 'datetime') ...)
>
> I want to count the number of notifications that have been sent out on any 
> given day using a 1 day resolution, but I can't make "notified" a date 
> because I need 1 second resolution as to when the notification was sent for 
> a different measurement.
>
> Is there an easy way to do a groupby such that the notified date is 
> grouped by day and not by second? I've tried this:
>
> db(...).select(db.mytable.notified, db.mytable.notified.count(),
>     groupby=(db.mytable.notified.year() | db.mytable.notified.month() | 
> db.mytable.notified.day()),
>     orderby=(db.mytable.notified.year() | db.mytable.notified.month() | 
> db.mytable.notified.day()),
> )
> but this will cause a ticket saying that I also need to put in "| 
> db.mytable.notified", which will screw up the 1 day resolution. Any 
> thoughts as to how to do this elegantly, without making a duplicate field, 
> but type "date" instead of "datetime"?
>

Reply via email to