RE: [PHP] Random PostreSQL

From: Date: Wed, 02 Aug 2000 16:44:12 +0000
Subject: RE: [PHP] Random PostreSQL
Groups: php.general 
Request: Send a blank email to php-general+get-9718@lists.php.net to get a copy of this message
This is very interesting, Has anyone actually tested to see if this works? If it does, i'd appreciate a code snipet on weberdev. Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -----Original Message----- From: Robin Vickery [mailto:robin@planet-three.co.uk] Sent: Wednesday, August 02, 2000 12:45 PM To: php-general@lists.php.net Cc: joe@jWebMedia.com Subject: Re: [PHP] Random PostreSQL joe@jWebMedia.com writes: > 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 oidrand(oid, int) takes an oid and a probability factor and returns true or false based on that probability. oidsrand(int) seeds the random number generator. The probability factor is a little odd, the actual probability of any row being selected is 1/factor. SELECT * FROM mytable WHERE oidrand(oid, 10); Would select approx 1/10 of the rows in the table. -robin -- Robin Vickery............................................... Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK Email: robin@planet-three.net Phone: +44 (0)794 670 6395 -- 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

« previous php.general (#9718) next »