X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D06253677 for ; Fri, 8 Apr 2005 17:30:49 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71461-08 for ; Fri, 8 Apr 2005 16:30:42 +0000 (GMT) Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by svr1.postgresql.org (Postfix) with SMTP id CFE6353666 for ; Fri, 8 Apr 2005 17:30:40 +0100 (BST) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp100.rog.mail.re2.yahoo.com with SMTP; 8 Apr 2005 16:30:40 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 8C1B53D2E; Fri, 8 Apr 2005 12:30:39 -0400 (EDT) Date: Fri, 8 Apr 2005 12:30:39 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: getting count for a specific querry Message-ID: <20050408163039.GE27718@phlogiston.dyndns.org> References: <000001c53c3e$f4f5b730$797ba8c0@jfradkin> <20050408150731.GB27718@phlogiston.dyndns.org> <1112977065.7444.30.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1112977065.7444.30.camel@localhost.localdomain> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/98 X-Sequence-Number: 20991 On Fri, Apr 08, 2005 at 04:17:45PM +0000, Ragnar Hafstaš wrote: > On Fri, 2005-04-08 at 11:07 -0400, Andrew Sullivan wrote: > > > > SELECT count(*) FROM tablename WHERE condition LIMIT n; > the LIMIT clause limits the number of rows returned by the select, > in this case 1 row. > > maybe you mean something like: > > test=# select count(*) from (select * from a limit 2) as foo; Yes, that was stupid of me. That's what I meant, though. A -- Andrew Sullivan | ajs@crankycanuck.ca When my information changes, I alter my conclusions. What do you do sir? --attr. John Maynard Keynes