"Martin Engelschalk" on Friday, May 20, 2011 10:21 AM wrote...

> Hi,
>
> to order, you have to use "order by". In that case, however, it gets
> complicated.
>
> SELECT * FROM Jobs WHERE rec IN (87, 33, 27,2, 1)
> order by case rec when 87 then 1
>                   when 33 then 2
>                   when 37 then 3
>                   when 2 then 4
>                   when 1 then 5
>           end;
>
> Martin

Thanks, this will work.

>
> Am 20.05.2011 15:55, schrieb jose isaias cabrera:
>> "Oliver Peters" on Friday, May 20, 2011 9:47 AM wrote...
>>
>>
>>> jose isaias cabrera<cabrera@...>  writes:
>>>
>>>>
>>>> Greetings.
>>>>
>>>> I would like to get a bunch of records of IDs that I already know. For
>>>> example, this table called Jobs,
>>>> rec,...,data,...
>>>> 1,...,aaa,...
>>>> 2,...,zzz,...
>>>> ...
>>>> ...
>>>> 99,...,azz,...
>>>>
>>> [...]
>>>
>>>
>>> What about
>>>
>>> SELECT *
>>> FROM table
>>> WHERE id BETWEEN 1 AND 99;
>>>
>>> greetings
>>> Oliver
>> I presented a bad example, Oliver.  My apologies.  I want specific IDs, 
>> so
>> the WHERE rec IN (1,2,27,33,87) works perfectly.  However, I have one 
>> last
>> question: if I do this call,
>>
>> SELECT * FROM Jobs WHERE rec IN (87, 33, 27,2, 1)
>>
>> the result is 1, 2, 27, 33, 87.  How can I get that specific order?
>>
>> thanks,
>>
>> josé
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 

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

Reply via email to