Forum Moderators: open

Message Too Old, No Replies

Help with a query

Sql

         

belfasttim

12:26 am on Mar 25, 2009 (gmt 0)

10+ Year Member



Sorry to post a dumb question, I think this is simple but I've been banging my head against it and could use another set of eyes-- any help appreciated!

I'm data mining for searches run from my website. Many searches run each day, so I need to get the average for each value for each day in the date range. How would I do this with a single query? Right now I'm messing with:

SELECT AVG(price_low), AVG(price_high), AVG(parts_low), AVG(parts_high), DATE(timestamp) AS date
FROM searches WHERE 1
GROUP BY timestamp

So instead of having 200 rows returned for only 10 dates, I'd like 10 rows, with averages of the values searched within each day.

belfasttim

1:29 am on Mar 25, 2009 (gmt 0)

10+ Year Member



Nevermind, just forgot the distinct at the beginning of the statement. otherwise works as is.

thanks anyway

whoisgregg

5:44 pm on Mar 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it sorted belfasttim. :)

LifeinAsia

5:48 pm on Mar 25, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Glad you got it sorted

Actually, I think he got it GROUPed... ;)

whoisgregg

6:30 pm on Mar 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



::groan:: Good one, LifeinAsia. ;)