RE: [PHP] Random PostreSQL
| From: | Christensen, BruceX R | Date: | Tue, 01 Aug 2000 20:30:40 +0000 |
| Subject: | RE: [PHP] Random PostreSQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9543@lists.php.net to get a copy of this message | ||
I really doubt that's possible. If the table's small enough, you could just
grab all of the rows in your SELECT query, but only actually use some of
them. If it's very large (but each row has a sequential number, such as an
auto-incrementing primary key [in which case it's important that no records
have been deleted from the middle of the series of primary keys]), you could
find out how many rows there are in the table, then do something like SELECT
* FROM table WHERE id=rand1 OR id=rand2, etc, where rand1 and rand2 are
random numbers you've generated that are between the lowest and highest
primary key.
--Bruce
Bruce Christensen
Intel Corporation
brucex.r.christensen@intel.com
-----Original Message-----
From: joe@jWebMedia.com [mailto:joe@jWebMedia.com]
Sent: Tuesday, August 01, 2000 1:26 PM
To: php-general@lists.php.net
Subject: [PHP] Random PostreSQL
Anyone know of a simple way to select a random group of records from
postgeSQL? Can't find anything in the manual that is of any help to me.
Thanks,
Joe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net