![]() |
I need some quick SQL help
In one table named AD I have a date_of_birth field, saved like 1970/01/30
In another table named AQ I have quote_date saved like 2009/01/30 I want to create a new column in AD called "age" and save how old they were when they got the quote. So on January 30th, 2009, they were 39 years old. I want to save "39" to a new field in the same row as date_of_birth. Important note: Both fields are strings, not date fields. :/ Oracle, but most SQL statements work.. Also doesn't need to be to-the-day accurate. How do I do this? |
What you want is the same as the DateDiff() function in sql server but Oracle does not have a DateDiff function.
Here is a solution I found for getting days, hours, minutes: http://asktom.oracle.com/pls/asktom/...42712657900129 I would usually use a DateDiff() that returned months and then divide them by 12 to get the age. Not sure of the best way to do that in Oracle. As far as the dates being strings you should be able to cast them as dates. Hope that helps. . |
|
All times are GMT -7. The time now is 04:31 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123