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?

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())) )

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())))'

Are you using Access and Jet?
Datepart will not work--it works only with SQL Server

Yes I am using Access and Jet

Any other solution?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.