0

Hello,

I am developing a simple calender in my site which will display the next upcoming birthday of my member.

I have a table which has 2 column


cname | dob
-------------------
Joe | 9/12/1982
Mathew | 2/17/1997
Pat | 8/23/1880
-------------------

What SQL Query should I use to get the name of that person?

3
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by Killer_Typo
0

Hi, i think the following should help / give you an idea (eg retrieves names of members whose dob falls in current month--according to system date)

select cname from tablename wherE
datepart (mm,convert(datetime,dob))
= (select datepart(mm,convert(datetime,getdate())) )

0

Thanx but it generates this error

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error. in query expression 'datepart (mm,convert(datetime,dob)) = (select datepart(mm,convert(datetime,getdate())))'

0

Yes I am using Access and Jet

Any other solution?

suppliment his solution a little. what language are you using to build the database. you may be suited to just use that language to get the current date and then pass that into the query.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.