Re: order_by clause to preserve order in list? - redux

2011-02-21 Thread Phlip
>   SELECT * FROM table WHERE id IN (1, 3, 2) ORDER BY >        FIELD( id, 1, 3, 2 ) I got it to work, but I had to borrow .extra(where=[]), which I consider a spectacular design failure of the .extra(order_by=[]) system. Firstly, I TDD using SQLite3, so I had to write code to build either

order_by clause to preserve order in list? - redux

2011-02-21 Thread Phlip
Djangoes: I have this question, copied from the archives: 8<- 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,