Hi Victoria,

that's exactly what I needed. Works fine.
I know Subselects only from Intrbas/Firebird so far. I know that I can pass
a SELECT to the list of columns of a SELECT if it only returns one result
(one col, one row). So I thought/hoped/imagined/expected I can pass a SELECT
returning multiple rows in only one col to an aggregate function.

Thanks and bye,
Bernhard

----- Original Message ----- 
From: "Victoria Reznichenko" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 19, 2004 2:34 PM
Subject: Re: Subselect in aggregate function in MySQL 4.1.1a-alpha


> [EMAIL PROTECTED] wrote:
> >
> > Hi,
> >
> > I have some logging data from a webserver in a table and want to do some
> > analysis.
> > I infact want to see how many files are requested at one time.
> > To do this I
> > SELECT COUNT(time) anz FROM table GROUP BY time ORDER BY anz DESC
> > This gives me the number of requests at any time. I now want to see the
> > average number of requests per time.
> > I thus thought I can use a subselect like
> > SELECT AVG(SELECT COUNT(time) anz FROM table GROUP BY time) FROM table
> >
> > That seems impossible, it in fact simply does not work.
> > Is it wrong by my design or is it MySQL design not to pass a subselect
> > to an aggregate function?
> >
>
> If I've got you right you need:
>
> SELECT AVG(anz) FROM (SELECT COUNT(time) anz FROM table GROUP BY time) as
table1;
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to