[EMAIL PROTECTED] wrote:

> Hello,
> 
> I'm trying to retrieve a limited number of random rows, and order them by a
> column, and am not having any luck with that last part:
> 
> SELECT * FROM tablename ORDER BY random(), id LIMIT 10

How about:

SELECT * FROM
(SELECT * FROM tablename ORDER BY random() LIMIT 10) AS data
ORDER BY id;

HTH,

Mike Mascari
[EMAIL PROTECTED]



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to