Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Queries using the end of current year date

Posted on 2011-09-11
4
Medium Priority
?
204 Views
Last Modified: 2012-05-12
In November of each year I need to be able to update the age of each member as of 12/31/XXXX, whatever the current year. How do I write the update queries EofY Age and EofY LOM without having to change the date in the queries each year? Thank you.
0
Comment
Question by:lheroux
4 Comments
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 36520640
To get the end of the current year:

Dateserial(year(now()),12,31)
0
 
LVL 18

Accepted Solution

by:
lludden earned 2000 total points
ID: 36520643
Age at end of current year is:

UPDATE mytable SET Age =  int(DateDiff("m",Birthdate,DateSerial(Year(Now()),12,31))/12)
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 37218503
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This collection of functions covers all the normal rounding methods of just about any numeric value.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question