![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: May 2002
Location: Toronto
Posts: 8,475
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,073
|
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 cookies cleared! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,073
|
__________________
All cookies cleared! |
![]() |
![]() ![]() ![]() ![]() ![]() |