performing functions on live data

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

performing functions on live data

Post 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
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post 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
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Aha. The server is in fact running an older version. Thanks.
Post Reply