MySQL Forums
Forum List  »  Newbie

Re: MONTH(TODAY) Commands
Posted by: Craig Tidwell
Date: August 22, 2005 02:30PM

Roland,
Thanks for replying.
I have an access database with the Field Record under BIRTHDATE showing in this format mm/dd/yyyy.

My .ASP page looks for my Access database using mySQL.
var adoConnection = Server.CreateObject("ADODB.Connection");
var adoRecordSet;
var mySQL;
dbName="/database.mdb"
dbf=Server.MapPath (dbName)
adoConnection.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" + dbf);
var mySQL = "SELECT * from EE_info where BIRTHDATE=NOW()";
adoRecordSet = adoConnection.Execute(mySQL);


BIRTHDATE
2/3/1975
6/21/1966
8/22/1984
9/12/1981
12/30/1954
etc...

I want to select anyone whose birthday will fall in the next 7 days and display them on the screen.

I was using MONTH(BIRTHDATE)=MONTH(NOW()) AND DAY(BIRTHDATE)>=DAY(NOW()) AND DAY(BIRTHDATE)<=DAY(NOW())+7 and it returns everyone for this month for the next 7 days.

But in the future (over a month end and year end), things will get messed up. I tried these other commands, but it doesn't pull any data even though I think I am asking for the right thing:

MONTH(DATE_ADD(CURDATE(),INTERVAL 1 MONTH));
DATE_FORMAT(BIRTHDATE, '%j');

Is that a different version of msSQL. Can I just use Excel to create the database and save it as a ";" separated database? Can I avoid using Access?

-Craig.

Options: ReplyQuote


Subject
Written By
Posted
August 22, 2005 10:07AM
August 22, 2005 12:28PM
Re: MONTH(TODAY) Commands
August 22, 2005 02:30PM
August 22, 2005 03:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.