Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ANSI SQL Date Calculations against Oracle Rdb data
Message
 
 
To
21/07/1999 17:32:34
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00244314
Message ID:
00244630
Views:
16
>>>
>>>"WHERE [Date subtraction calculation] <= 18" && Kid is under 18 years old
>>>
>>>- or -
>>>
>>>"WHERE [Date subtraction calculation] <= 90" && Kid is under 90 months old
>>>
>>>I need to do subtraction since I'm looking for kids with the dx in the past 3 years so I need to calculate Dob vs discharge date.

Sorry for the thick-headedness. In Oracle, there is a function called MONTHS_BETWEEN which returns the months between 2 dates --

...where MONTHS_BETWEEN(SYSDATE, DX) <= 18

The order of the dates passed is important because Date2 [DX] is subtracted from Date1 [SysDate].

There is another function called ADD_MONTHS which works exactly the same as VFP's GOMONTH function. The 1st parameter is a date, and the 2nd parameter is the number of months to either add or subtract from the date.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform