Comcast,

Simply order by the random function, RAND(). For example:

  SELECT aff.*
    FROM financial_affiliates AS aff
   WHERE aff.state = 'wa'
     AND aff.category = '3'
ORDER BY RAND();

Regards,
Adam

-----Original Message-----
From: Comcast [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 10, 2003 8:05 PM
To: [EMAIL PROTECTED]
Subject: how to do a random ORDER BY in a SELECT statement


I am querying a table and using the following statement:

SELECT * FROM financial_affiliates WHERE state = 'wa' AND category = '3'
ORDER BY name

I would like to ORDER BY RANDOM - is there an easy way to do that. 

Thanks.

-Doug

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

Reply via email to