[freetds] Query - Sum(data) by Date?

Shaun Craig s.craig at andronics.com
Thu Nov 10 11:34:28 EST 2005


Thanks to everyone who sorted this out for me, I know theres a wealth of 
knowledge on this forum.

Shaun.

Thompson, Bill D (London) wrote:

>you want to discount the time portion of the date, i take it ?
>
>select object, sum(level), convert(char(11), datetime, 109)
>from Flow
>group by object, convert(char(11), datetime, 109)
>
>HTH...    www.dbforums.com is a good forum for sql difficulties
>
>Bill
>
>-----Original Message-----
>From: freetds-bounces at lists.ibiblio.org
>[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Shaun Craig
>Sent: 10 November 2005 15:48
>To: FreeTDS Development Group
>Subject: [freetds] Query - Sum(data) by Date?
>
>
>How do i go about this, i have a single table 'Flow' which holds values 
>for a particular object for a date, ie
>
>'Object'      'Level'      'Date/Time'
>
>Object1      2.0            Nov 09 2005 10:02AM
>Object1      3.3            Nov 09 2005 11:32AM
>Object1      1.2            Nov 09 2005 13:12PM
>etc........
>Object1      3.4            Nov 10 2005 04:12AM
>Object1      0.1            Nov 10 2005 11:23PM
>etc...
>
>I want a query which will sum(level) for each date, so result will look 
>like the following
>
>'Object'      'Total Level for Date'      'Date'
>
>Object1      6.5                                    Nov 09 2005
>Object1      3.5                                    Nov 10 2005
>
>Any ideas, had a look on the web but you need to sign up to stuff to see
>
>solutions, not an option.
>
>Thanks,
>
>Shaun.
>_______________________________________________
>FreeTDS mailing list
>FreeTDS at lists.ibiblio.org
>http://lists.ibiblio.org/mailman/listinfo/freetds
>--------------------------------------------------------
>
>If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/
>--------------------------------------------------------
>




More information about the FreeTDS mailing list