Posted by Chris Hope on 05/11/05 11:34
lkrubner@geocities.com wrote:
> All the timestamps in my code are wrong by 90 minutes.
>
> date INT(11),
>
> I'd like to add 5400 to every date field in my database. Rather than
> do this in PHP, I'm wondering if MySql has a command that would allow
> me to do this directly.
This ought to do it:
update tablename set fieldname = fieldname + 5400
If you've named your field "date" you'll need to enclose the fieldname
with backticks as date is a reserved word in MySQL ie
update tablename set `date` = `date` + 5400
Actually I could be wrong about having to have backticks. I know there's
an exception for at least one reserved word (which is probably "date")
which works without the backticks because it was so commonly used as a
fieldname and they didn't want to break compatibility, or something
along those lines.
--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Navigation:
[Reply to this message]
|