>> In a slight change of this question (since I have no data to
>> currently test this with, as my ISP is using too old a
>> version of mysql), does anyone know what something like
>> this would do?
>>
>> SELECT * FROM theTable ORDER BY RAND(), date LIMIT 5;
>
> Exactly the same as SELECT * FROM
> Gotcha. So is there any way to return 5 (some number) rows, chosen
> randomly, and then sort them by date (or name or whatever). So the final
> result is a list, sorted by date, but of rows chosen randomly from the
> table.
CREATE TEMPORARY TABLE temptable TYPE=HEAP SELECT * FROM theTable ORD
> In a slight change of this question (since I have no data to
> currently test this with, as my ISP is using too old a
> version of mysql), does anyone know what something like
> this would do?
>
> SELECT * FROM theTable ORDER BY RAND(), date LIMIT 5;
Exactly the same as SELECT * FROM theTable O
In a slight change of this question (since I have no data to currently test
this with, as my ISP is using too old a version of mysql), does anyone know
what something like this would do?
SELECT * FROM theTable ORDER BY RAND(), date LIMIT 5;
I'd like to be able to pull out a certain number of row
> I don't think the answer has changed since last week :-)
>
> IMHO it's not "really slow and inefficient", anyway - this script:
(clipped)
> produces a table with 1 rows each containing an integer. Then we do:
>
> mysql> SELECT * FROM mytable ORDER BY RAND() LIMIT 5;
(clipped)
> 5 rows in set
You asked this earlier this week.
The answer has not changed.
Matt Heaton wrote:
> Hi all, trying to do something and have it be as efficient as possilble. My
> question is if I have a table with say 10,000 rows in it, and I issue
> a command like this
>
> select * from table where number=1 o
e
as doing this little experiment.
So what's so inefficient? I can't blink in 0.08 seconds, let alone think a
query is running too slowly.
Cheers
Jon
-Original Message-
From: Matt Heaton [mailto:[EMAIL PROTECTED]]
Sent: 15 June 2001 14:23
To: [EMAIL PROTECTED]
Subject: orde
Hi all, trying to do something and have it be as efficient as possilble. My
question is if I have a table with say 10,000 rows in it, and I issue
a command like this
select * from table where number=1 order by rand() limit 1;
If 1000 rows would match this command does mysql first find all 1000