Received: from pooh.strategicnetwork.org (IDENT:root@pooh.strategicnetwork.org [159.26.242.70]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA44155 for ; Mon, 6 Mar 2000 10:32:31 -0500 (EST) (envelope-from justinlong@strategicnetwork.org) Received: from JDLONG (mid-tgn-ngd-vty4.as.wcom.net [216.192.75.4]) by pooh.strategicnetwork.org (8.9.3/8.9.3) with SMTP id KAA04650 for ; Mon, 6 Mar 2000 10:30:44 -0500 Received: by localhost with Microsoft MAPI; Mon, 6 Mar 2000 10:31:40 -0500 Message-ID: <01BF8757.2898CBB0.justinlong@strategicnetwork.org> From: Justin Long Reply-To: "justinlong@strategicnetwork.org" To: "'pgsql-sql@postgreSQL.org'" Subject: Selecting random element? Date: Mon, 6 Mar 2000 10:31:39 -0500 Organization: Network for Strategic Missions X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4211 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Does anyone have a way to select a random element without doing a complete select on the database first? For example, right now I would have to (under PHP3): $rs = pg_exec($db,"SELECT * FROM database"); $rec = pg_fetch_object($rs,rand(1,pg_numrows($rs))); It would be a lot easier to just do a $rs = pg_exec($db,"SELECT * from database RANDOM") or some such where it would select a random row. _____ Justin Long Network for Strategic Missions 1732 South Park Court, Chesapeake, VA 23320 Ofc 757-420-4500, Fax 757-226-5006, Email justinlong@strategicnetwork.org Never retreat. Never surrender. Never cut a deal with a dragon. http://www.strategicnetwork.org