On 12 Apr 2013 10:27, rob@xxxxxxxxx wrote:
On a related note, I don't think this is valid:
&SqlStmt *bcat 'UsedDate desc'
because I don't think you can order by a derived column unless you do
one of two things:
One, do an order by 4, which means use the fourth column.
Or, two, use a CTE (Common Table Expression) and put your order by
after the CTE like this
with T1 as (
select
odlbnm, odobnm, odobtp, ... as createDate, ... as UsedDate, odobtx
from qtemp/dspqry)
select * from T1 order by CreateDate

It is valid. I have no recollection of since when, but the SQL allows using the named expression in the ORDER BY. Works fine on v5r3.


This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.