Re: Many aggregates in one query
From: Matti Teppo <matti.teppo_at_nospam.deio.net>
Date: Thu, 23 Aug 2001 08:21:14 +0200
Message-ID: <3B84A0D9.AEBF1EE5_at_nospam.deio.net>
Date: Thu, 23 Aug 2001 08:21:14 +0200
Message-ID: <3B84A0D9.AEBF1EE5_at_nospam.deio.net>
> But the idea is to substitute
> the query for a table in the from clause.
This would be the ideal solution. Unfortunately it is not supported by all vendors. I would write:
select min(wsid) as wsid, rowcnt
from (select wsid, count(*) as rowcnt
from test
group by wsid
having count(*) = min(count(*))
)
group by rowcnt
Sybase ASE does not accept this in version 12.0. Implementing the "from" query as view and selecting from it works fine.
Matti Received on Thu Aug 23 2001 - 08:21:14 CEST