Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Count uniques ?
Adriano Lul
4/28/2008 11:53:00 AM
I need to know how I use the count function to have a sum of days
ie: I have several transactions in several days like hmmm Tasks
Task -> id, price, day , description
so in every day I did some tasks
I sum them with the Task.sum(:price)
but I want to do an automatized way to have an average description (sum
/ days )
how can I do it ?
ps: day is datetime ...
--
Posted via
http://www.ruby-...
.
1 Answer
Roger Pack
4/28/2008 4:22:00 PM
0
You can substract datetimes to get the difference between them in seconds.
Time.now - Time.now
Use that to average?
On Mon, Apr 28, 2008 at 5:53 AM, Adriano Lul <adrianod@gmail.com> wrote:
> I need to know how I use the count function to have a sum of days
> ie: I have several transactions in several days like hmmm Tasks
> Task -> id, price, day , description
>
> so in every day I did some tasks
> I sum them with the Task.sum(:price)
> but I want to do an automatized way to have an average description (sum
> / days )
> how can I do it ?
> ps: day is datetime ...
> --
> Posted via
http://www.ruby-...
.
>
>
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Count uniques ?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password