[thelist] SQL Problem

david garcia watkins dgw at q-logic.org
Mon May 7 05:48:47 CDT 2001


If I remember correct, SQL Server has a set of function for date
manipulation. Something similar to this should work (I cant remember the
exact name or syntax of the function, you will have to look it up in the
manual).

SELECT date_part("day", timestamp) as day, avg(value) FROM table GROUP BY
day

Cheers!

David
----- Original Message -----
From: "Marios Andreas Tofarides" <matofarides at hotmail.com>
To: <thelist at lists.evolt.org>
Sent: Monday, May 07, 2001 1:34 AM
Subject: [thelist] SQL Problem


> Hello to everyone out there
>
> I have a problem with an SQL query. I am using ASP with SQL Server 7 on
> Windows NT 4.0 Server. The problem is this:
> I have this table
>
> Timestamp                        Value
> ------------------------------------
> 01/01/2000  01:00              10.8
> 01/01/2000  02:00                8.6
> 01/02/2000  01:00                9.7
> 01/02/2000  02:00                9.5
>
> And I want to get the average value for each day. i.e. I want these
results
>
> Date                      Average
> 01/01/2000               9.7
> 01/02/2000               9.6
>
> Thank you for your help.
>                         Marios
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list