I need a little help in updating my DATE fields on my db.
I have to update every DATE field that has a date in which hour, minute and seconds are "00:00:00".
The format of the date is "yyyy-mm-dd HH:mm:ss".
First question: is there a way to do this?
Second question: how can it be done?
Thank you very much for the help!
EDIT: I need to update that field with the same date with only hour (and minute, and seconds) changed. Thanks
質問する
1145 次
2 に答える
3
DATE_FORMAT
MySQLの機能を利用できます。
例
UPDATE Table_Name set Field ='EDITVALUE'
WHERE DATE_FORMAT(dateField, "%h/%i/%s") = "00:00:00";
回答を編集
CONCAT
MySQLの機能を利用できます。
UPDATE Table_Name set dateField = CONCAT(date(dateField),' 05:12:50');
于 2013-04-24T10:13:30.043 に答える
0
update table_name
set column_name='your date'
where DATE_FORMAT(column_name, "%h/%i/%s") = "00:00:00"
またはSQLサーバーで
update table_name
set column_name='your date'
where
CONVERT(VARCHAR(8), column_name, 14)='00:00:00'
于 2013-04-24T10:13:20.573 に答える