From: Ed <dziablo@lords.com>
To: pgsql sql <pgsql-sql@postgresql.org>
Subject: Sub select..
Date: Fri, 31 Mar 2000 16:11:13 -0500
Message-ID: <000301bf9b55$a511dd00$b48c29d1@citenet.net> (raw)
Hi,
I would like to know if ther is a way of doing something like this :
select max(col1) from (select count(*) as col1 from table1 where index_field
= 3 group by day);
table1 loking like :
day | index_field | ...
-------------------------------------
1 1
1 1
1 3
1 3
2 3
3 1
3 3
Finally, I only want to know the maximum count(*) value grouped by day
my sub query should return me :
col1
-------
2 (for day 1)
1 (for day 2)
1 (for day 3)
So, Max(col1) would return me " 2 "
but... imbriqued select doesn't seems to work in 6.5.3....
Any suggestions?
/fb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dziablo@lords.com
Subject: Re: Sub select..
In-Reply-To: <000301bf9b55$a511dd00$b48c29d1@citenet.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox