473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Find age of employee

I have two fields in a query that hold dates. One is DOB, the other is
HireDate. I want to add a field to a query that will take the
employees DOB and based on their hire date, wil display their age in
years and months at the time they were hired. I then need to add a
query field to take the HireDate and TermDate (termination date) to
show their length of tenure with the company.

Thanks-

Scott

Jul 11 '07 #1
2 2159
On 11 Jul, 06:06, Scott <s...@henryschein.comwrote:
I have two fields in a query that hold dates. One is DOB, the other is
HireDate. I want to add a field to a query that will take the
employees DOB and based on their hire date, wil display their age in
years and months at the time they were hired. I then need to add a
query field to take the HireDate and TermDate (termination date) to
show their length of tenure with the company.
Read up on DateDiff.

To get the age of the employee in years at the date of hire :

SELECT DateDiff("yyyy", DOB, Hired) as StartAge
FROM Table1;

The rest is left as an exercise for the reader.

Edward

Jul 11 '07 #2
<te********@hotmail.comwrote
Read up on DateDiff.

To get the age of the employee in years at the date of hire :

SELECT DateDiff("yyyy", DOB, Hired) as StartAge
FROM Table1;
Read up on DateDiff.

From the immediate window:

? DateDiff("y",#12/31/2000#,#01/01/2001#)
1

By normal reckoning, a baby born on the 31st of December is not one year old
the next day.

? DateDiff("yyyy",#12/31/2000#,#01/01/2007#)
7

According to most cultures, a person born the 31st of December 2000 will not
be 7 years old until the 31st of December 2007.

Yes, there are cultures in which the child is considered age 1 at the moment
of birth. Is your culture one of those? But, in any case, the simplistic
calculation you show is not accurate for that view either.

There is a Knowledge Base article on calculating age at
http://support.microsoft.com/kb/100136/en-us which takes the date within the
year into account.
Jul 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Morten Gulbrandsen | last post by:
USE company; DROP TABLE IF EXISTS EMPLOYEE; CREATE TABLE EMPLOYEE ( # PK SSN CHAR(9) NOT NULL, # FK SUPERSSN CHAR(9), DNO INT NOT NULL DEFAULT 1, CONSTRAINT EMPPK
13
by: Sue | last post by:
I'm working on a database that keeps track of employees hired by a general contractor on a project by project basis. These employees are hired to work on a project and are then laid off either at...
1
by: Brian | last post by:
I'm trying to find a way to search multiple tables for the same record. Say I have 3 tables all with a name column, I need to search all 3 tables and find matching names. Is there an easy way to...
8
by: Richard Sherratt | last post by:
It's a database keeping info about people and is expected to contain 20,000 to 25,000 people. I could put a GoToPerson Combo on the form, but the customer and I are not to keen on that. It makes...
17
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). ...
17
by: RSH | last post by:
I am really trying to grasp the concept of OOP as it applies to C#. I am looking at trying to set up a simple Employee Class but I am having trouble conceptualizing what this class should look...
0
by: Kaur | last post by:
Hi, I am having problem trying to go to same record when I close 3rd form. I have a form called frmDepartment. This form has a list box that displays all the departments. Clicking on one of the...
3
by: jhhbr549 | last post by:
Can some help me with this. Please review this code for errors. I can not get it to complie. Here is my Code .. This is an abstract class that is used in conjuntion with 4 other classes.. ...
15
by: uwcssa | last post by:
I try to drop a table as: I got: During SQL processing it returned: SQL0478N The object type "TABLE" cannot be dropped because there is an object "sch.SQL070515104729271", of type "FUNCTION",...
5
by: cart1443 | last post by:
So I know I need to add a few more lines somewhere to make this work, but I'm not sure how. // Lab 3: EmployeeTest.java // Application to test class Employee. /* Begin class declaration of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.