English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi all,

I have a table containing daily dates of working days through several years.

What I would like to have is to be able to choose a date and then find its corresponding date one year later.

An example would be: the date 2000-01-01 and its corresponding date: 2001-01-01. The problem is that 2000-01-01 wasn't a working day and so I will not be able to find it in my table.

Is there any trick for telling mySQL to find a corresponding date in a certain interval that is also actually found in the table?

Am I clear with my question??

I would be happy to hear your opinion about this :-)

Thanks!

2006-10-19 23:24:04 · 3 answers · asked by Micron 2 in Computers & Internet Programming & Design

3 answers

Don't think of dates as three numbers (day month year) but instead as one compound number (like a computer uses internally). That way instead of looking for dates in the range say 10/10/2006 to 15/10/2006, you can just look in a number range say 75673 to 75782. (These numbers are made up - don't try to read any meaning in them).

As far as I'm aware, dates are already stored like this in most applications - I'm assuming that SQL is no different.

Rawlyn.

2006-10-19 23:32:42 · answer #1 · answered by Anonymous · 0 0

You are clear with the question but I don't have an answer. Sorry.

2006-10-20 06:27:35 · answer #2 · answered by Just Bein' Me 6 · 0 1

Micron try this link

http://www.google.co.uk/search?hl=en&q=Find+occurrence+of+dates+inside+a+given+year+in+sql&btnG=Search&meta=

2006-10-20 07:13:56 · answer #3 · answered by Joe_Young 6 · 0 1

fedest.com, questions and answers