Gary Baranzini wrote:
> SELECT id  FROM pointslocation  WHERE id IN (1,7,3,4,5,2,6)
>
> How do I retain the order in the IN list?

If you don't want to create a (temporary) table for the ordering, you
can also do the mapping from id to the order in the query itself:

  SELECT id
  FROM pointslocation
  WHERE id IN (1,7,3,4,5,2,6)
  ORDER BY CASE id
           WHEN 1 THEN 1
           WHEN 7 THEN 2
           WHEN 3 THEN 3
           WHEN 4 THEN 4
           WHEN 5 THEN 5
           WHEN 2 THEN 6
           WHEN 6 THEN 7
           END




Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to