Thanks, later on I'm going to try this, will post results here.

Bye, Hans.


Johan De Meersman schreef op 07-10-14 om 16:10:
----- Original Message -----
From: "Trianon 33" <triano...@gmail.com>
Subject: Need a short directive

Values from yearanddate look like this: 2013-12-11 00:00:00. I want to
That's only a display format; internally it's an integer (well, presumably a 
struct time_t) counting the seconds since epoch. Not especially relevant except 
to say that, since it's only an output format, it can easily be changed.

copy the 2013 and put that into the yearfield, for each record.

Can that be done by just using SQL statements?
I believe the year() function is pretty much what you're looking for; complexer 
things can be handled through date_format().

Something along the lines of

  UPDATE table
    SET year = year(yearanddate);

should do nicely; I'm sure you can fix up a where clause as appropriate.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to