Chris, please don't tell someone "this is the best way", when the solution
is dependant on so many other factors (as stated in my original reply). Our
answers strongly influence other peoples decisions, and "best practice"
answers should only ever be given if you are 100% sure it is correct, and
have personally experimented with every other possible method.

Please don't take offence to this email, I would expect someone to say the
same to me if I had made a similar mistake.


> On 21 Feb 2011 00:31, "Christophe Pettus" <x...@thebuild.com> wrote:
>
>
> On Feb 20, 2011, at 2:19 PM, galago wrote:
>
> > What is the best way, to select X random rows from DB...
>
> The best way is to push it onto the DB, using a raw query:
>
>        random_results = Table.objects.raw("SELECT * FROM table ORDER BY
> random() LIMIT X")
>
> --
> -- Christophe Pettus
>   x...@thebuild.com
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group....
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to