![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The host server I am using is MySQL version 4.0.27-standard, which does not have DATEDIFF. I am asking the host to upgrade, but in the meantime, I still need to get my query to work: SELECT fields FROM table WHERE DATEDIFF(YYYY-MM-DD,NOW())>= 0 Are there alternatives? Please advise. Thanks in advance. |
#3
| |||
| |||
|
|
On Mon, 07 Jan 2008 01:46:35 GMT, Adrienne Boswell wrote: The host server I am using is MySQL version 4.0.27-standard, which does not have DATEDIFF. I am asking the host to upgrade, but in the meantime, I still need to get my query to work: SELECT fields FROM table WHERE DATEDIFF(YYYY-MM-DD,NOW())>= 0 Are there alternatives? Please advise. Thanks in advance. -- Not tested, but should give you the idea SELECT fields FROM table WHERE DATE_ADD(mydatecol, INTERVAL 1 MONTH) >= NOW(); gets you all the records in the past month. |
| http://dev.mysql.com/doc/refman/4.1/...functions.html Just watch the version numbers when features were added and you'll be fine. |
#4
| |||
| |||
|
|
Gazing into my crystal ball I observed "Peter H. Coffin" hellsop (AT) ninehells (DOT) com> writing in news:slrnfo361n.ih0.hellsop (AT) abyss (DOT) ninehells.com: On Mon, 07 Jan 2008 01:46:35 GMT, Adrienne Boswell wrote: The host server I am using is MySQL version 4.0.27-standard, which does not have DATEDIFF. I am asking the host to upgrade, but in the meantime, I still need to get my query to work: SELECT fields FROM table WHERE DATEDIFF(YYYY-MM-DD,NOW())>= 0 Are there alternatives? Please advise. Thanks in advance. -- Not tested, but should give you the idea SELECT fields FROM table WHERE DATE_ADD(mydatecol, INTERVAL 1 MONTH) >= NOW(); gets you all the records in the past month. Yup, works fine for February on, but no joy for anything in January. http://dev.mysql.com/doc/refman/4.1/...functions.html Just watch the version numbers when features were added and you'll be fine. |
#5
| |||
| |||
|
|
Adrienne Boswell wrote: Gazing into my crystal ball I observed "Peter H. Coffin" hellsop (AT) ninehells (DOT) com> writing in news:slrnfo361n.ih0.hellsop (AT) abyss (DOT) ninehells.com: On Mon, 07 Jan 2008 01:46:35 GMT, Adrienne Boswell wrote: The host server I am using is MySQL version 4.0.27-standard, which does not have DATEDIFF. I am asking the host to upgrade, but in the meantime, I still need to get my query to work: SELECT fields FROM table WHERE DATEDIFF(YYYY-MM-DD,NOW())>= 0 Are there alternatives? Please advise. Thanks in advance. -- Not tested, but should give you the idea SELECT fields FROM table WHERE DATE_ADD(mydatecol, INTERVAL 1 MONTH) >= NOW(); gets you all the records in the past month. Yup, works fine for February on, but no joy for anything in January. http://dev.mysql.com/doc/refman/4.1/...functions.html Just watch the version numbers when features were added and you'll be fine. Can you post exactly what you are trying to do? DATEDIFF(YYYY-MM-DD,NOW()) is not a valid expression. Assuming that your YYYY-MM-DD actually refers to a date ot datetime column, what is wrong with just doing YYYY-MM-DD >= NOW() |
#6
| |||
| |||
|
|
Wow! It worked. I must have had something wrong in my original query. Thank you for hitting me on the head with the obvious! |
#7
| |||
| |||
|
|
Adrienne Boswell wrote: Wow! It worked. I must have had something wrong in my original query. Thank you for hitting me on the head with the obvious! Hope it didn't hurt too much! |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |