× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The simple solution is to use the POSITION function in the order-by-clause as

select ...... order by position(substring(field1, 1, 1) in 'acdb')


Sometimes it is a good idea to look in the sql-reference-manual!

regards Wolfgang





"Walden H. Leverich" <mailto:WaldenL@xxxxxxxxxxxxxxx> schrieb:
OK, that's and odd request. This would work, but it's ugly:

Select key, desc, 1 from table where key='a' union
Select key, desc, 2 from table where key='c' union
Select key, desc, 3 from table where key='d' union
Select key, desc, 4 from table where key='b'
Order by 3

However, is that actually what you're trying to do? Or is it more like
the key field is a FK reference to another table, and you want to sort
on the description in that other table and the order results in the key
in your table sorting as a, c, d, b? If so, just join and sort on the
right field.

-Walden

--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
mailto:WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list
To post a message email: mailto:JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: mailto:JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.