On Sep 24, 5:10 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-09-23 at 07:01 -0700, coan wrote:
>
> > I want to fetch a list of items in my database, and I have their id
> > ready:
> > my_ids_to_get = [ 1, 3, 2, ]
>
> > In mysql I would fetch them like this:
> > SELECT * FROM table WHERE id IN (1, 3, 2)ORDERBY FIELD( id, 1, 3,
> > 2 )
>
> > This would preserve theirorder.
>
> > Can I build this query with the native django order_by?
>

> No. You can't pass arbitrary SQL functions to order_by.

> Regards,
> Malcolm

Ok! Thanks for clearing it up for me :-)

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to