473,401 Members | 2,125 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,401 software developers and data experts.

Run query on anniversary of a date

Hi,

I have a table that stores clients with their birthday stored in a date
field 0000-00-00 (EG: YYYY-MM-DD).

I have no idea how to even begin writing a query so that it will select
all birthdays having an anniversary in the selected period.

EG: between now and 7 days for example.

It basically needs to ignore the year and only look at the month and days.

I thought this would have been a really common thing to need to be able
to do, and was hoping Mysql had some fancy function to do it.

Is there?

Many thanks,

Ax
Jul 23 '05 #1
3 1957
Axrock wrote:
Hi,

I have a table that stores clients with their birthday stored in a date
field 0000-00-00 (EG: YYYY-MM-DD).

I have no idea how to even begin writing a query so that it will select
all birthdays having an anniversary in the selected period.

EG: between now and 7 days for example.

It basically needs to ignore the year and only look at the month and days.

I thought this would have been a really common thing to need to be able
to do, and was hoping Mysql had some fancy function to do it.

Is there?

Many thanks,

Ax


There is look in the manual for date functions an example is there.

http://dev.mysql.com/doc/mysql/en/da...culations.html

Look at the bottom of the page just before the user comments at the
examples of finding birthdays (for animals in this case).

HTH

Jonathan
Jul 23 '05 #2
Hi,

Thanks for that. MySql documentation isn't the easiest to navigate. That
is exactly what i am after.

Ax

Jonathan wrote:
Axrock wrote:
Hi,

I have a table that stores clients with their birthday stored in a
date field 0000-00-00 (EG: YYYY-MM-DD).

I have no idea how to even begin writing a query so that it will
select all birthdays having an anniversary in the selected period.

EG: between now and 7 days for example.

It basically needs to ignore the year and only look at the month and
days.

I thought this would have been a really common thing to need to be
able to do, and was hoping Mysql had some fancy function to do it.

Is there?

Many thanks,

Ax

There is look in the manual for date functions an example is there.

http://dev.mysql.com/doc/mysql/en/da...culations.html

Look at the bottom of the page just before the user comments at the
examples of finding birthdays (for animals in this case).

HTH

Jonathan

Jul 23 '05 #3
Axrock wrote:
Hi,

Thanks for that. MySql documentation isn't the easiest to navigate. That
is exactly what i am after.

Ax

Jonathan wrote:
Axrock wrote:
Hi,

I have a table that stores clients with their birthday stored in a
date field 0000-00-00 (EG: YYYY-MM-DD).

I have no idea how to even begin writing a query so that it will
select all birthdays having an anniversary in the selected period.

EG: between now and 7 days for example.

It basically needs to ignore the year and only look at the month and
days.

I thought this would have been a really common thing to need to be
able to do, and was hoping Mysql had some fancy function to do it.

Is there?

Many thanks,

Ax


There is look in the manual for date functions an example is there.

http://dev.mysql.com/doc/mysql/en/da...culations.html

Look at the bottom of the page just before the user comments at the
examples of finding birthdays (for animals in this case).

HTH

Jonathan


You're welcome but a hint for future posts...

A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Take a look at topic 6 here:
http://linux.sgms-centre.com/misc/netiquette.php
Jul 23 '05 #4

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

Similar topics

6
by: paii | last post by:
I have a table that stores job milestone dates. The 2 milestones I am interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18. All jobs have TypeID 1 only some jobs have TypeID 18....
8
by: Adam Louis | last post by:
I would like help resolving this problem. I'm a novice who's been hired to query a hospital database and extract useful information, available to me only in a dynamically generated, downloadable...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
5
by: ????? | last post by:
I have an access query which gets data from a number of different tables. Although the tables have primary key fields, the order in which the records are returned means that none of these are in...
11
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive...
2
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database...
2
by: sixdeuce62 | last post by:
Hello, I am trying to create a query that will prompt me to enter the parameter value if beginning date and ending date. I have created everything I need in the query, but I have to manually go...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
18
by: mlcampeau | last post by:
I have a lengthy query that I am now trying to filter. The query calculates an employee's Anniversary Date in which they are eligible for the next level of Annual Vacation. (i.e. For 1-6 years of...
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: 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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.