How is the data going in? are you updating the hit count? then its easy.
select site,hits,bytes from table order by hits desc limit 10
Curtis
On Tue, 6 May 2003, Sam Evans wrote:
> I've been faced with an interesting design dilemma.. I have a pretty
> straight forward table such as:
>
> +------------+------------------------+----------+------------+-------------------+
> | keyid (INT) | site (VARCHAR 250) | hits (INT) | bytes (INT) | dts
> (DATETIME) |
> +------------+------------------------+----------+------------+-------------------+
>
> This table will keep track of 7 days worth of data.. What I'm tasked
> with, is to come up with a method that will take the 7 days of data, and
> produce a top X sites over the 7 day period based on either cumulative
> hits / bytes.
>
> For example, to show the stop 25 Websites by way of hits for the last 7
> days.
>
> In perl/php I could easily select * from table WHERE (dts BETWEEN
> start_date AND end_date), push the results into a hash and do my
> additions from within the hash. Unfortunately, the language I am
> programming this in, is not perl/php but is cold fusion.
>
> My question, does it make sense to create a stored procedure that does
> this, and just returns the data I want to present to the user? Or,
> should I figure out some way for Cold Fusion to emulate the perl/php
> hash method? (And no, I can't ditch Cold Fusion -- I tried already. ;) )
>
> Thanks for any tips / help.
>
> -Sam
>
>
>
>
>
--
--
Curtis Maurand
mailto:curtis@stripped
http://www.maurand.com