You can simply include this in your SQL logic:
            , tradeName
            , Case When Name <> ' ' Then Name Else tradeName End As Sort_Field
  Order By 3

Ron Power <RPower@xxxxxxxxxx> wrote:
  Not sure if I'm in the right list for this question but...
is it possible to join two files by a Roll Number, then order the 
resultset by two different fields? Example:
I have two files on the iSeries. One is a master, the other is a 
supplementary file that contains extra information. They are joined by a 
roll number (15 digit number assigned to a property). The master file has 
a name field and the supplementary file has a trade name field. Sometimes 
the name field contains the business name, sometimes the trade name field 
does. I want to get a result set that sorts the files where if the trade 
name field is populated to use that in the sort otherwise use the name 
field in the sort. So if we have the following files:
Record1: Name="aaa" tradename=""
Record2: Name="aac" tradename=""
Record3: Name="aad" tradename="aab"

So that they output in the following order:


Ron Power
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
Success is going from failure to failure without a loss of enthusiasm. - 
Sir Winston Churchill

This email communication and accompanying documents is intended only for the 
individual or entity to which it is addressed and may contain information that 
is confidential, privileged or exempt from disclosure under applicable law. Any 
use of this information by individuals or entities other than the intended 
recipient is strictly prohibited. If you have received this in error, please 
notify the sender and delete all the copies (electronic or otherwise) 

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

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