I have a database consiting of customer details, and I have to write a report that will return all customers who have a birthday between 2 dates.
The database holds the dob, so what I did was I brought the dob up to the year of the dates and then just did a BETWEEN() clause. All well and good, but it occurs to me that on some occasions the 2 dates may not be in the same year. It could be 31/12/2001 to 7/1/2002 or something. So my piece of code is useless for that eventuality.
Anyone got any good code for working out if somebody has a birthday between 2 dates if the dates are in different years?
The database holds the dob, so what I did was I brought the dob up to the year of the dates and then just did a BETWEEN() clause. All well and good, but it occurs to me that on some occasions the 2 dates may not be in the same year. It could be 31/12/2001 to 7/1/2002 or something. So my piece of code is useless for that eventuality.
Anyone got any good code for working out if somebody has a birthday between 2 dates if the dates are in different years?