Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id ECCBE633AE1 for ; Wed, 18 Nov 2009 15:27:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01836-05 for ; Wed, 18 Nov 2009 19:27:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd-17937.dedibox.fr (sd-17937.dedibox.fr [88.191.100.74]) by mail.postgresql.org (Postfix) with ESMTP id AD334632ADB for ; Wed, 18 Nov 2009 15:27:10 -0400 (AST) Received: from laptop.localnet (ASte-Genev-Bois-153-1-68-208.w86-198.abo.wanadoo.fr [86.198.38.208]) by sd-17937.dedibox.fr (Postfix) with ESMTPA id A71953B8EE; Wed, 18 Nov 2009 20:27:09 +0100 (CET) From: Guillaume Lelarge To: pgsql-sql@postgresql.org Subject: Re: LIMIT BASED ON PERCENT Date: Wed, 18 Nov 2009 20:27:08 +0100 User-Agent: KMail/1.12.2 (Linux/2.6.31-14-generic; KDE/4.3.2; i686; ; ) Cc: Another Trad , Lee Hachadoorian References: <5ab13580911181121g6e89759doa6c6ea6557424f71@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200911182027.08857.guillaume@lelarge.info> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/52 X-Sequence-Number: 33403 Le mercredi 18 novembre 2009 =E0 20:24:09, Another Trad a =E9crit : > No, It doesn't. > In my machine: >=20 > First select > ERROR: syntax error at end of input > LINE 1: select * from rapadura.cliente limit 20% > ^ > Second one: > ERROR: argument of LIMIT must not contain subqueries >=20 > Postgres 8.3 >=20 It works for Lee because obviously he's working on a 8.4 server. You can us= e=20 subquery in a LIMIT clause if you have an 8.4 PostgreSQL server. For earlie= r=20 releases, there's no way to do this in a single query. =2D-=20 Guillaume. http://www.postgresqlfr.org http://dalibo.com