Jean-Francois(dot)Doyon(at)CCRS(dot)NRCan(dot)gc(dot)ca 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
mascarm(at)mascari(dot)com