Page 1 of 1

performing functions on live data

Posted: Thu Sep 04, 2003 3:28 pm
by Unipus
MySQL.

For a table which include a DATE column named EndDate, I am trying to perform the following action:

SELECT day(EndDate) from tablename;

I must have the syntax wrong somehow, because it just spits me an error 1064, but I've tried lots of variations on this based on the examples in the MySQL manual, and they all do the same. Is there something I need to do to get it to be able to process live data?

thanks

Posted: Thu Sep 04, 2003 5:36 pm
by Stoker
What version of mysql do you use? according to the manual the day() (alias for dayofmonth) did not appear until MySQL 4.1.1

Posted: Thu Sep 04, 2003 6:27 pm
by JAM

Code: Select all

-- new in mysql 4.1.1
SELECT DAY(EndDate);
-- works in earlier versions (examples of usage)
SELECT DAYOFMONTH(EndDate);
SELECT DAYOFYEAR(EndDate);
Wierd, almost an hour after the previous userpost, but I didn't see any replies at all until afterwards. Oh well...

Posted: Fri Sep 05, 2003 12:56 pm
by Unipus
Aha. The server is in fact running an older version. Thanks.