Actually, having tried that, you still need the ORDER BY RAND() in there.
Otherwise, I keep getting the same record over and over. But it surely cuts way
down on the number of rows that need to be sorted.
So if your table size is fairly stable, and you pick a good number for the
WHERE constant,
> From: mos
>
>
> At 10:34 AM 10/24/2011, you wrote:
>> select id from table order by rand() limit 1;
>> is doing as example a dumb temporary table with the full size
>
> Because it has to sort the entire table, then it returns the one row. This of
> course is extremely inefficient. :)
That i
I was using this query and getting queer results:
SELECT MemberID, Surname, Houshold, Houmuch, CASE WHEN Houmuch <
(SELECT sharePrice FROM Stock) THEN ADDDATE(ereStart, (Houmuch * (SELECT hwyl
FROM Stock)) / (SELECT regularPayment FROM Stock)) ELSE TIMESTAMPADD(YEAR, 2,
CURDATE()) END A