Hi Justin,

Like Rob, I'm curious why this is necessary:

order by case when :H <> :H
then NumericCol --decimal(7) TableA
else CharCol end ; --char(6) TableA

Since :H will never be unequal to :H, it's apparent you only want to use CharCol as the sort key.


If it's a design requirement, I would think there should be a way to actually select the sort order, something like

order by case when :H = 'numeric'
then NumericCol --decimal(7) TableA
else CharCol end ; --char(6) TableA


If you just want to document the choices you could simply make one of them a comment

order by
-- NumericCol --decimal(7) TableA
CharCol; --char(6) TableA

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx
pdow@xxxxxxxxxxxxxx /

On 10/24/2024 10:24 AM, Justin Taylor wrote:
Rob:
The statement runs fine with just "ORDER BY CharCol".
sele
I put the case in the ORDER BY because there's a design requirement that
specifies those two different sort orders for the results.


Vern:
That explains it.


Thank you

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.