On Sun, 27 Jan 2002, Michael Widenius wrote:

> One way to do this is to do as follows:
> SELECT something FROM sometable WHERE somevar=somevalue ORDER BY
> RAND() LIMIT 10

OK. I still think that my extended LIMIT syntax would be a good idea, 
because ORDER BY RAND() does not seem to be very fast.

I tried adding a field that numbers all instances of a certain ID (this 
probably breaks some normalization rule). This way I could simulate what 
things would be like with an extended LIMIT syntax. This SQL statement:

SELECT varWord FROM dictionaryword WHERE intTypeID='11' AND 
(intTypeCounter<26)

executed a lot faster than:

SELECT varWord FROM dictionaryword WHERE intTypeID='11' ORDER BY RAND()
LIMIT 25

Thus, I still think it would be a good idea to be able to say:

SELECT COUNT(*) AS greve FROM dictionaryword WHERE intTypeID='11'

and then:

SELECT varWord FROM dictionaryword WHERE intTypeID='11' LIMIT number1,1,
number2,1,number3,1,number4,1,..

> >> team called Monty & Kaj and wrote a PacMan clone called Blipp for the
> >> ABC80 computer decades ago? Man, that game was cool! ;)
> Yes, it was I who wrote that games ages ago...

Cool! I played it a lot as a kid.

________________________________________
Ulf Härnhammar
System Developer

ST-Registry
St Eriksgatan 117, E2
SE-113 43 Stockholm
SWEDEN (GMT+1)

Telephone:      +46 (0)8-545 476 04
Facsimile:      +46 (0)8-32 63 33

E-mail: [EMAIL PROTECTED]
Web: http://www.nic.st/

The STreet domain - your Internet address


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to