"Andrew Gatt" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> I'm guessing my SQL is the worst way of doing things so i've been
> trying to find a better method. I stumbled across "SELECT name FROM
> table WHERE id IN (x,y,z) however this doesn't allow me to specify
> the order the rows are returned, which i must have.

Create a temporary table, populate it with your IDs, then join to it:

create temp table ids(ordno integer primary key, id integer);
insert into ids(id) values (45);
insert into ids(id) values (32);
...
select t.name from mytable t join ids on (t.id = ids.id)
order by ids.ordno;

Igor Tandetnik



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

Reply via email to