Many thanks Dimitre
This looks like a winner will let you know how I get on.
Rgds Yobbo
"Radoulov, Dimitre" <cichomitiko@gmail.com> wrote in message
news:454dcfd6$0$49200$14726298@news.sunsite.dk...
>> SELECT STRINGTEXT, TOKENID
>> FROM WEBSTRINGS
>> WHERE TOKENID IN (6,20,234,19,32,4,800,177)
>>
>> All I want is my resultset to come back in the order that I have defined
>> in
>> the IN clause, but unfortunately SQL is trying to be too helpful and
>> sorts
>> the numbers in the IN clause so that the resultset comes back with a
>> TOKENID
>> order of 4,6,19,20,32,177,234,800.
>>
>> I don't want this bloody order I want 6,20,234,19,32,4,800,177!!
>
> Far from elegant:
>
> SELECT STRINGTEXT, TOKENID
> FROM WEBSTRINGS
> WHERE TOKENID IN (6,20,234,19,32,4,800,177)
> ORDER BY
> TOKENID=6 DESC,
> TOKENID=20 DESC,
> TOKENID=234 DESC
....
[...]
This one is better
SELECT STRINGTEXT, TOKENID
FROM WEBSTRINGS
WHERE TOKENID IN (6,20,234,19,32,4,800,177)
ORDER BY
FIELD(TOKENID,6,20,234,19,32,4,800,177);
Regards
Dimitre