[web2py] Re: GROUP BY Date, Ignore Time

2011-05-30 Thread Massimo Di Pierro
notice you can also do:

post_date=db.posts.posted_date.year()|db.posts.posted_date.month()|
db.posts.posted_date.day()

set = db(db.posts.id).select(db.posts.posted_date,
count,groupby=pos_date)

in case you need it in more than once place.

On May 30, 6:38 pm, Neodudeman  wrote:
> Awesome. Exactly what I needed, thank you.
>
> On May 29, 4:14 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > set = db(db.posts.id).select(db.posts.posted_date, count,
> > groupby=db.posts.posted_date.year()|db.posts.posted_date.month()|
> > db.posts.posted_date.day())
>
> > On May 29, 2:42 pm, Neodudeman  wrote:
>
> > > Hi web2py; I've got some problems.
> > > I'm attempting to get a count of some rows based on thedate; but when
> > > I attempt the grouping, it includes thetimeas well, giving me a
> > > false count. (Since no two rows were created at the exact same second,
> > > the count never goes above 1 per 'date')
>
> > > Here's my current code:
>
> > > count = db.posts.id.count()
> > > set = db(db.posts.id).select(db.posts.posted_date, count,
> > > groupby=db.posts.posted_date)
>
> > > How can I change the groupby toignorethetimeportion of the
> > > posted_date?


[web2py] Re: GROUP BY Date, Ignore Time

2011-05-30 Thread Neodudeman
Awesome. Exactly what I needed, thank you.

On May 29, 4:14 pm, Massimo Di Pierro 
wrote:
> set = db(db.posts.id).select(db.posts.posted_date, count,
> groupby=db.posts.posted_date.year()|db.posts.posted_date.month()|
> db.posts.posted_date.day())
>
> On May 29, 2:42 pm, Neodudeman  wrote:
>
>
>
>
>
>
>
> > Hi web2py; I've got some problems.
> > I'm attempting to get a count of some rows based on thedate; but when
> > I attempt the grouping, it includes thetimeas well, giving me a
> > false count. (Since no two rows were created at the exact same second,
> > the count never goes above 1 per 'date')
>
> > Here's my current code:
>
> > count = db.posts.id.count()
> > set = db(db.posts.id).select(db.posts.posted_date, count,
> > groupby=db.posts.posted_date)
>
> > How can I change the groupby toignorethetimeportion of the
> > posted_date?


[web2py] Re: GROUP BY Date, Ignore Time

2011-05-29 Thread Massimo Di Pierro
set = db(db.posts.id).select(db.posts.posted_date, count,
groupby=db.posts.posted_date.year()|db.posts.posted_date.month()|
db.posts.posted_date.day())

On May 29, 2:42 pm, Neodudeman  wrote:
> Hi web2py; I've got some problems.
> I'm attempting to get a count of some rows based on the date; but when
> I attempt the grouping, it includes the time as well, giving me a
> false count. (Since no two rows were created at the exact same second,
> the count never goes above 1 per 'date')
>
> Here's my current code:
>
> count = db.posts.id.count()
> set = db(db.posts.id).select(db.posts.posted_date, count,
> groupby=db.posts.posted_date)
>
> How can I change the groupby to ignore the time portion of the
> posted_date?