RE: [PHP-DB] Rand()
| From: | Ed Lazor | Date: | Thu, 07 Oct 2004 16:03:41 +0000 |
| Subject: | RE: [PHP-DB] Rand() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36674@lists.php.net to get a copy of this message | ||
Hrm. Dunno then. I just manually tested it in MySQL and both approaches
worked. Are you able to test directly in MySQL? Might have to go to the
mysql list for this.
-Ed
> -----Original Message-----
>
> Yeah, I had tried that earlier but it doesn't work. It does generate
> a new value for temp each time but they are still in the same order as
> the first one always has a lower temp value....
>
>
> On Thu, 7 Oct 2004 06:40:23 -0700, Ed Lazor <ed.lazor@d20news.com> wrote:
> >
> >
> > select id, fname, lname, RAND() as temp from clients where featured=1
> order
> > by temp
> >
> > > -----Original Message-----
> > > I have the following query:
> > >
> > > Select id, fname, lname from clients where featured=1 order by RAND()
> > >
> > > At any time, there should only be three clients where featured =1.
> > > Problem is I have run this query several times yet it always returns
> > > them in the same order. Not sure it makes a difference but the
> > > primary key is on the id column. What am I doing wrong?