"Josh Berkus" <[EMAIL PROTECTED]> writes:
> The query I'll use is this:
> SELECT site, COUNT(pageviews) as count_views, AVG(pageviews) AS
> mean_views, median_views
> FROM sites,
> (SELECT pageviews as median_view
> FROM pageviews
> LIMIT 1 OFFSET middlerec('pageviews')) med
> GROUP BY site, median_views;
> Where middlerec is a custom function that counts the records and returns
> the middle one.
Um ... does that work? I thought LIMIT was fairly restrictive about
what it would take as a parameter --- like, constants or $n parameters
only.
I do not know of any median-finding algorithm that doesn't require a
depressingly large amount of storage...
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly