|
How about: (DATE_YY > SelectedYear or (DATE_YY = SelectedYear and (DATE_MM > SelectedMonth or DATE_MM = SelectedMonth and DATE_DD >= SelectedDay))) and (DATE_YY < Selected Year or (DATE_YY = SelectedYear and (DATE_MM < SelectedMonth or DATE_MM = Selected Month and DATE_DD <= SelectedDay))) Out of curiosity, why do you want to use SQL if the RPG code can easily select the records? Donald R. Fisher, III Project Manager Roomstore Furniture Company (804) 784-7600 extension 2124 DFisher@xxxxxxxxxxxxx <clip> What I can't seem to figure out is how to use SQL to select a date range that doesn't result in a table scan. These result in a table scan: SELECT DATE_YY * 10000 + DATE_MM * 100 + DATE_DD FROM TABLE WHERE (DATE_YY * 10000 + DATE_MM * 100 + DATE_DD) >= 20051001 AND (DATE_YY * 10000 + DATE_MM * 100 + DATE_DD) <= 20051028 SELECT DIGITS(DATE_YY) || DIGITS(DATE_MM) || DIGITS(DATE_DD) FROM TABLE WHERE (DIGITS(DATE_YY) || DIGITS(DATE_MM) || DIGITS(DATE_DD) >= '20051001' AND (DIGITS(DATE_YY) || DIGITS(DATE_MM) || DIGITS(DATE_DD) <= '20051028' This one doesn't, but it's problematic: SELECT DIGITS(DATE_YY) || DIGITS(DATE_MM) || DIGITS(DATE_DD) FROM TABLE WHERE (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 1) OR (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 2) OR (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 3) OR (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 4) OR ... (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 25) OR (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 26) OR (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 27) OR (DATE_YY = 2005 AND DATE_MM = 10 AND DATE_DD = 28) <clip>
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.