Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 30006633D82 for ; Wed, 18 Nov 2009 15:21:25 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 73847-05 for ; Wed, 18 Nov 2009 19:21:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.210.181]) by mail.postgresql.org (Postfix) with ESMTP id E8C76632ADB for ; Wed, 18 Nov 2009 15:21:13 -0400 (AST) Received: by yxe11 with SMTP id 11so1275454yxe.15 for ; Wed, 18 Nov 2009 11:21:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=/jUXDWOOY//VQqk2jiNSao20HWdd/VRrWoPh5YoxWnE=; b=awf9KOvLz7H0XtsPS05wR3m61uujJdZMyw07MWTZUyru/WhuYxPoQ7ZEbMVip7/oXQ hooYvZ+XXK4cCcVAKz621VCKgC83h6C1FGMTOkLcAC9qJqN5PYzM14hpKF21EmuS8/lY 3sZZ2d4Dc+aBZ49eJ5EpYvxaojYOYv4HhTtUs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=E+velnbKNVFeZQF2rfnZJtPCJD6m6TE/epdmxBxZUZc32JmRR7sH0+/Qfr+9r+AuAa B+KVSf69/gs4cn4/sbQqv9Ol8sXPIM0bVbrLaHajoK9gv+wRUZSFQL/NSzcTAUdIhVYd uey8xen5tOqEPZjvw5q4eMDxUNlzAfbc/eNbA= MIME-Version: 1.0 Received: by 10.91.18.5 with SMTP id v5mr2736302agi.91.1258572066370; Wed, 18 Nov 2009 11:21:06 -0800 (PST) In-Reply-To: References: Date: Wed, 18 Nov 2009 14:21:06 -0500 Message-ID: <5ab13580911181121g6e89759doa6c6ea6557424f71@mail.gmail.com> Subject: Re: LIMIT BASED ON PERCENT From: Lee Hachadoorian To: Another Trad Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.392 tagged_above=-10 required=5 tests=AWL=-1.207, BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 200911/50 X-Sequence-Number: 33401 Your SQL works for me exactly as it is (substituting a table in my database). What error are you getting? On Wed, Nov 18, 2009 at 2:12 PM, Another Trad wrote: > My question is quite simple: I want to select all the records from my table, > but I want apply a LIMIT of 20% in the lines. like: > select * from client limit 20% > I have tried (of course, with no success) this: > select * from client limit ((select count(*) from client)*20/100) > -- Lee Hachadoorian PhD Student, Geography Program in Earth & Environmental Sciences CUNY Graduate Center