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



Brian,

Select datefld, timefld from tablea
UNION ALL
Select datefld, timefld from tableb
Order by datefld, timefld


If the column names aren't the same:

Select dateflda as datefld, timeflda as timefld from tablea
UNION ALL
Select datefldb as datefld, timefldb as timefld from tableb
Order by datefld, timefld 


--or--

Select dateflda, timefldb from tablea
UNION ALL
Select datefldb, timefldb from tableb
Order by 1,2



Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
 
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Brian Piotrowski
Sent: Thursday, November 10, 2005 10:04 AM
To: RPG programming on the AS400 / iSeries
Subject: Returning Values from two different Tables

Hi All,

 

I have some SQL code in my RPG program that pulls data from two
different tables.  For example, in TableA I have some records that are
in a specific date range.  In TableB, I have some records that match the
same date range plus and additional parameter (ie: fieldb = 'XX').  I
then need to concatenate the results of both of these tables into a
single list.  So the data would look something like this:

 

Data Results:

==========

(TableA) 2005/11/04 11:04am

(TableA) 2005/11/04 11:06am

(TableB) 2005/11/04 11:07am

(TableA) 2005/11/04 11:09am

(TableB) 2005/11/04 11:10am

Etc..

 

Would I be better off to bring the select results into an array, sort
and display the results, or could I do this through and SQL statement
without having to worry about arrays and such?

 

Thanks for your thoughts.


Brian.

 

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Brian Piotrowski

Specialist - I.T.

Simcoe Parts Service, Inc.

PH: 705-435-7814

FX: 705-435-6746

-=-=-=-=-=-=-=-=-=-=-=-=-=-

 


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