Tim

At 07:22 PM 5/28/1998 -0400, you wrote:
>Hi All,
>Question:  I have a simple transaction file (physical file) I have to
>process for a report, this file is sequenced by CUST# then CCYYMMDD.
>Now for the summary query reporting on the CUST#, I want get the (MIN)
>and the (MAX) in the CCYYMMDD field (column) so I can do the math in the
>query using the 2 fields (MIN) and (MAX) in order to arrive at the
>number of days we've done business with this Customer.  Suggestions
>appreciated on how I convert the (MIN) and the (MAX) to useable field
>names within the query.

Can't do in one pass in Query/400. But you can in SQL. You don't even need
field names, but you can use aliases, if desired. Something like

select cust#, min(ccyymmdd), max(ccyymmdd), days(max(ccyymmdd))
-days(min(ccyymmdd)) from file group by cust#

The parameter for the 'days' function has to be a date, timestamp, or valid
character representation of a date. Check the SQL manuals. If the fields
are date data type, no problem. Otherwise, you may need to convert to
character and insert date separators.

HTH

Vernon Hamberg
Systems Software Programmer
Old Republic National Title Insurance Company
400 Second Avenue South
Minneapolis, MN  55401-2499
(612) 371-1111 x480


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...

Replies:

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

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