473,396 Members | 1,773 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.

Urgent - Find age in each month of a year

I have the list of patients in the admittance table who were in care during the years 2004, 2005 and 2006.
The admittance table has fields, CaseID, SeqNbr, Birthdate
I want to find the patients who were 18 years and 1 month old in Jan 2004, Feb 2004.....Dec 2004 (basically each month of the year).
Similarly I need to do the same for 2005 and 2006.

Please treat this as urgent....thanks for the help.
Jan 4 '08 #1
1 1289
puppydogbuddy
1,923 Expert 1GB
I have the list of patients in the admittance table who were in care during the years 2004, 2005 and 2006.
The admittance table has fields, CaseID, SeqNbr, Birthdate
I want to find the patients who were 18 years and 1 month old in Jan 2004, Feb 2004.....Dec 2004 (basically each month of the year).
Similarly I need to do the same for 2005 and 2006.

Please treat this as urgent....thanks for the help.
Try this:

The following query uses the Age() function at this link:

http://allenbrowne.com/func-08.html

Expand|Select|Wrap|Line Numbers
  1. SELECT DatePart(Year(AdmitDate)) As AdmitYear , DatePart(Month(AdmitDate)) As AdmitMonth, CaseID, SeqNbr, BirthDate, Age([BirthDate]) As BirthAge
  2. FROM AdmittanceTable
  3. WHERE Round(BirthAge,2) = 18.09
  4. GROUP BY AdmitYear,  AdmitMonth, CaseID, BirthDate, BirthAge
  5. ORDER By AdmitYear, AdmitMonth, CaseID, BirthDate; 
  6.  
Jan 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: chennakeshava_ramesh | last post by:
hi, I have a problem, I am not able to find out which day of the week it is using the calendar class. I am using set() function to set the date and want to find out which day i.e mon,tue etc of...
6
by: Mark Anthony | last post by:
ok so first i will give write the question out, my code, the db structure, then what is going wrong. Write a report to return the top store in terms of Sales Dollars for each month sales have...
3
by: johkar | last post by:
I need to document.write out a select list populated with the dates for the first and third Wednesday of each month. How do I get to the actual days? <select name="mySelect"> <option value="Oct...
1
by: progII | last post by:
Hello, i am struggling the whole night cos of my c++ homework. deadline is very soon. (april 4th) i have to implement a calender. i store every calender entry in a list. a calender entry is...
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...
5
by: Ali Baba | last post by:
Hi, Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. Docs says that I can use TimeSpan like: TimeSpam ts =...
8
by: Aamir Wahid | last post by:
Hi i was trying to run a code in c++.net and i got this following error warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data i am putting my code here if any body...
23
by: thebjorn | last post by:
For the purpose of finding someone's age I was looking for a way to find how the difference in years between two dates, so I could do something like: age = (date.today() - born).year but that...
0
by: georges the man | last post by:
The purpose: • Sorting and Searching • Numerical Analysis Design Specification You are to write a program called “StockAnalyser”. Your program will read a text file that contains historical...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.