X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EA7C2D1C98E for ; Wed, 10 Mar 2004 16:47:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48230-04 for ; Wed, 10 Mar 2004 12:47:02 -0400 (AST) Received: from fs.frontsite.com.tr (unknown [217.195.194.174]) by svr1.postgresql.org (Postfix) with ESMTP id 610D8D1C9E1 for ; Wed, 10 Mar 2004 12:46:57 -0400 (AST) Received: from skyblue.office.frontsite.com.tr (localhost [127.0.0.1]) by fs.frontsite.com.tr (8.12.3/8.12.3/Debian-6.6.1) with ESMTP id i2AGXXLO018093 for ; Wed, 10 Mar 2004 18:33:34 +0200 Received: by skyblue.office.frontsite.com.tr (Postfix, from userid 1000) id 619F9630B0; Wed, 10 Mar 2004 18:48:18 +0200 (EET) Subject: randomized order in select? From: Enver ALTIN To: pgsql-sql@postgresql.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-qFGTSKs6YtXuzv5xbnOM" Organization: FrontSITE Bilgi Teknolojisi A.S. Message-Id: <1078937297.29628.12.camel@enver.office.frontsite.com.tr> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.5 Date: Wed, 10 Mar 2004 18:48:17 +0200 X-FrontSITE-MailScanner-Information: Please contact the ISP for more information X-FrontSITE-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/110 X-Sequence-Number: 17209 --=-qFGTSKs6YtXuzv5xbnOM Content-Type: text/plain; charset=ISO-8859-9 Content-Transfer-Encoding: quoted-printable Hi, I have got a simple table like this: create table tips ( id integer primary key unique, tiptext text ); and, I've got a website where I'm willing to show these tips in a random order. Each visitor will get a randomly selected tip. So for now, I have to do 2 queries: select id from tips collect an ID list, choose one randomly and retrieve it. I wish I could do something like: select tiptext from tips order by random limit 1 in PostgreSQL. --=20 __________ | | | | Enver ALTIN (a.k.a. skyblue) | | Software developer, IT consultant | FRONT | |=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D| FrontSITE Bilgi Teknolojisi A.=DE. |_____SITE_| http://www.frontsite.com.tr/ --=-qFGTSKs6YtXuzv5xbnOM Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBAT0bRZCB2FZvqK0sRApwSAJ9oSlWcNCsuq0b2J7PuJIKYPUqTlwCbBPmo pUDI2M46zVX9+0dbg3z1nS4= =l+78 -----END PGP SIGNATURE----- --=-qFGTSKs6YtXuzv5xbnOM--