Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 1FB189FA0FB for ; Fri, 17 Nov 2006 19:14:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 06372-06 for ; Fri, 17 Nov 2006 19:14:54 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by postgresql.org (Postfix) with ESMTP id BE36C9FA0E9 for ; Fri, 17 Nov 2006 19:14:53 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so1667228nfb for ; Fri, 17 Nov 2006 15:14:51 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=t3HIFONPDoO+FGvrRfx/4wT7m4iYZSVzymLXMc2AvX2soBxbKfqA32N8kEQMXuYzY4e9rP4rkrSuwK1LYmItuH/CHaeLY8Zyzl1yboDlZ5HX8qGRWw+dDxvezNZ3zQZfN4jFKlwYyvfjkWCi8y8SmV6QvDKxfAEzHpN3AP39m0k= Received: by 10.78.50.5 with SMTP id x5mr2450243hux.1163805291377; Fri, 17 Nov 2006 15:14:51 -0800 (PST) Received: by 10.78.136.6 with HTTP; Fri, 17 Nov 2006 15:14:51 -0800 (PST) Message-ID: Date: Fri, 17 Nov 2006 17:14:51 -0600 From: "Aaron Bono" To: "A. Kretschmer" Subject: Re: Random() Cc: pgsql-sql@postgresql.org In-Reply-To: <20061116191632.GA21285@a-kretschmer.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10785_4479716.1163805291348" References: <55c095e90611161031h7a1ce42chd9a59a53ba7e7028@mail.gmail.com> <20061116191632.GA21285@a-kretschmer.de> X-Google-Sender-Auth: 44c90e3b8f5bff92 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/190 X-Sequence-Number: 26842 ------=_Part_10785_4479716.1163805291348 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11/16/06, A. Kretschmer wrote: > > am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da > Rocha folgendes: > > Hi list, > > > > I have a bigint collumn and I would like to generate a random number > within the > > numbers of my column. > > select from order by random() limit 1; Is this a PostgreSQL thing or is it SQL standard? -- ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_10785_4479716.1163805291348 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11/16/06, A. Kretschmer <andreas.kretschmer@schollglas.com> wrote:
am  Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da Rocha folgendes:
> Hi list,
>
> I have a bigint collumn and I would like to generate a random number within the
> numbers of my column.

select <bigint_column> from <your_table> order by random() limit 1;

Is this a PostgreSQL thing or is it SQL standard?

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_10785_4479716.1163805291348--