[thelist] SQL Problem

Marios Andreas Tofarides matofarides at hotmail.com
Sun May 6 19:33:54 CDT 2001


Dear Rudy,
> you need to group by the day part of the date, i.e. drop the time part
>
>   select theday=convert(char(10),timestamp,102),avg(value)
>     from yourtable
>    group by theday
>
> 102 is the ansi format including century, yyyy.mm.dd

This is a nice idea, i'll try it

> you could try declaring a view, that will work --
>
>   create view dayonly (theday, value)
>    as select convert(char(10),timestamp,102), value
>      from yourtable
>
> then
>
>   select theday, avg(value)
>      from dayonly
>       group by theday
>

I don't know whether creating a view for each day would be a good idea,
because i beleieve it is gonna be too slow for the web page to show up.
Thank you anyway!!!

Marios




More information about the thelist mailing list