-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Doug, et al --

...and then David T-G said...
% 
% ...and then Comcast said...
% % 
% % I would like to ORDER BY RANDOM - is there an easy way to do that. 
% 
...
% I don't know if you can select random() like you can select count() but
% perhaps you don't even need that temp table...

Behold ... the [4.0.6-gamma] manual! :-)

  You can't use a column with RAND() values in an ORDER BY              
  clause, because ORDER BY would evaluate the column multiple           
  times. In MySQL Version 3.23, you can, however, do: SELECT *          
  FROM table_name ORDER BY RAND() This is useful to get a random        
  sample of a set SELECT * FROM table1,table2 WHERE a=b AND c<d         
  ORDER BY RAND() LIMIT 1000. Note that a RAND() in a WHERE             
  clause will be re-evaluated every time the WHERE is executed.         
  RAND() is not meant to be a perfect random generator, but             
  instead a fast way to generate ad hoc random numbers that will        
  be portable between platforms for the same MySQL version.   

So there ya go.  Good luck!


HTH & HAND

:-D
- -- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE/X79yGb7uCXufRwARAuCWAJ9D2csVVpJIfNDHyPok2kjOOlPsTACfUdhY
935VJygN1BRbWtcy/xIkqT8=
=TfZT
-----END PGP SIGNATURE-----

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to