× 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.



What is the difference between these two statements?
Case 1 <> 1 then numericCol end
Case :H <> :H then numericCol end

On Fri, Oct 25, 2024 at 8:01 AM Justin Taylor <jtaylor.0ab@xxxxxxxxx> wrote:

This works. Thank you

order by
(case :H <> :H then NumericCol end),
(case :H = :H then CharCol end)




date: Thu, 24 Oct 2024 07:39:51 -0500
from: Vern Hamberg via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
subject: Re: Implicit cast on ORDER BY

Hi Justin

I just googled for *conditional order by* and got an interesting hit
that might help.

In a CASE, the results must be the same data type, I saw. It wasn't IBM
i, but the rule still holds.

One solution was to use multiple CASE, something like this - I'm just
taking a wild shot here - each CASE can have its own data type -

order by
(case :H <> :H then NumericCol end)
(case :H = :H then CharCol end)

Your USING clause would add a couple values.

Here's a link to the page -
https://stackoverflow.com/questions/15621609/t-sql-conditional-order-by

Regards
Vern


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



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.