Count uniques ?

Discussion in 'Ruby' started by Adriano Lul, Apr 28, 2008.

  1. Adriano Lul

    Adriano Lul Guest

    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-forum.com/.
    Adriano Lul, Apr 28, 2008
    #1
    1. Advertising

  2. Adriano Lul

    Roger Pack Guest

    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 <> 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-forum.com/.
    >
    >
    Roger Pack, Apr 28, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derek LaZard

    Re: Abt Datareader Count

    Derek LaZard, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,733
    Derek LaZard
    Jul 8, 2003
  2. Isaac
    Replies:
    2
    Views:
    3,809
    Arvind Kumar
    Aug 18, 2003
  3. kellygreer1

    Filtering a Python list to uniques

    kellygreer1, Mar 25, 2008, in forum: Python
    Replies:
    7
    Views:
    652
    Gabriel Genellina
    Mar 26, 2008
  4. efelnavarro09
    Replies:
    2
    Views:
    917
    efelnavarro09
    Jan 26, 2011
  5. Jack
    Replies:
    22
    Views:
    253
    Ted Zlatanov
    Aug 10, 2006
Loading...

Share This Page