|
On 02/03/99 05:20:19 AM david.kahn wrote: >"Dennis Lovelady" <dennis@lovelady.com> wrote: > >>>Greater than 19 (not 20) >>>and greater than 99. >> >>Different columns are being compared. It's cool. :^) > >Sorry, Dennis, I'm not with you. How can any valid year have a century part >greater than "19" and a year part greater than "99"? No records will pass. >Assume our comparison date is CCYY. > >To test equal: Century=CC AND Year=YY >To test greater than: Century>CC OR (Century=CC AND Year>YY) >To test less than: Century<CC OR (Century=CC AND Year<YY) > >This should work for any date including the edge cases 1999 and 2000. >Health warning - the following code has not been tested - that's Booth's >problem. :-) > >= 1999 > I C 117 118 EQC19 > IAC 54 55 EQC99 > >=2000 > I C 117 118 EQC20 > IAC 54 55 EQC00 > >>1999 > I C 117 118 GTC19 > I C 117 118 EQC19 > IAC 54 55 GTC99 > >>2000 > I C 117 118 GTC20 > I C 117 118 EQC20 > IAC 54 55 GTC00 > ><1999 > I C 117 118 LTC19 > I C 117 118 EQC19 > IAC 54 55 LTC99 > ><2000 > I C 117 118 LTC20 > I C 117 118 EQC20 > IAC 54 55 LTC00 May I throw my hat into the ring? * Select from 1999/07 through 2000/01 inclusive * Drop the record if the year is too late O C 117 118EQC20 CC OAC 54 55GTC00 YY * Drop record if year is too early OOC 117 118EQC19 CC OAC 54 55LTC99 YY * Include dates within the specified month range I C 54 55EQC99 YY IAC 56 57GEC07 MM IOC 54 55EQC00 YY IAC 56 57LEC01 MM With all due respect, Dave has the right answer, but the specs for GT 1999 and LT 2000 still have comparisons that will always fail (LT00 and GT99). Again, respectfully, this was NEVER an easy problem to solve--we always put dates like this in contiguous fields so that we could use 2 statements: I C 54 61GEC19990701 CCYYMMDD IAC 54 61LEC20000101 CCYYMMDD Buck Calabro CommSoft, Albany, NY mailto:mcalabro@commsoft.net +--- | 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 +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.