At 12:55 -0400 10/6/03, Franck Babin wrote:
I have made some changed but it still doesn't work:

UDPATE activity SET activity_date = '2003-10-06 11:00:00', type_no = 1 WHERE
DATE_FORMAT(activity_date,'%Y-%m-%d %H:%i:%s') = '2003-06-10 11:15:00' AND type_no = 1;


I want to update only rows where <activity_date> equals '2003-06-10 11:15:00'
Is this formulation correct?

<activity_date> is really a DATETIME field.
Thanks.

In that case, you don't need DATE_FORMAT() at all. Just compare activity_date to the datetime value directly.

You still haven't indicated what you mean by the statement not working.
It doesn't find any rows to update?  Do you get any results from
the following statement, which simply tests the comparison?

SELECT activity_date FROM activity
WHERE activity_date = '2003-06-10 11:15:00';



--- Paul DuBois <[EMAIL PROTECTED]> wrote: > At 11:28 -0400 10/6/03, Franck Babin wrote:
 >I have this simple sql statement:
 >
 >UDPATE activity
 >SET activity_date = '9.10.2003 10:00:00', type_no = 1
 >WHERE DATE_FORMAT(activity_date,'%d.%m.%Y %H:%i') = '09.10.2003 10:00'
 >AND type_no = 1;
 >
 >I'm not able to execute the query. It seems that the <SET
 >activity_date = '9.10.2003 10:00:00'>
 >portion is not valid. <activity_date> is a DATETIME field.
 >Any idea?

 What do you mean by "is not valid"?  The comparison doesn't work?  The
 correct value doesn't get stored into the row?

 In any case, if activity_date really is a DATETIME column, you must
 store values in it using 'YYYY-MM-DD hh:mm:ss' format, not in the format
 you store above.

 If activity_date is *not* really a DATETIME column, but is stored using
 values in 'DD.MM.YYYY hh:ss' format, then DATE_FORMAT() will not work
 correctly.

 --
 Paul DuBois, Senior Technical Writer
 Madison, Wisconsin, USA
 MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


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


______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca

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


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


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



Reply via email to