Re: pulling out random content

From: Date: Mon, 19 Jun 2000 02:02:35 +0000
Subject: Re: pulling out random content
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2175@lists.php.net to get a copy of this message
On 16 Jun, dima wrote: > Hi everybody, > this could be a bit broader than a PHP question, nevertheless I hope > that some of you may have had this problem and could share a few ideas on > how to go around it. > > :: I am trying to pull out a certain number of rows from the database at > random (which is not a problem in itself). However, since it is random, > there is a chance that a number or two may appear more than once but I > need only unique values. > > Is there any nice way to deal with this problem. I don't want to end up > pushing it all into array, comparing all the values to each other and if > some match pull a number of extra rows from the table again, as if at > "random" over again. > It may work out for a small table. However once the number of "random" > numbers is large, it may be quite a resource consuming way of tackling the > problem. > > thanks in advance. Does SELECT DISTINCT do what you need? Cheers -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#2175) next »