update T set leave = now() where id =1 ;
出现如下错误:
1064-You have an error in your SQL syntax;check the manual that corresponds to your MySQL server version for the right syntax to use near 'leave =now () where id =1' at line 1请问如何修改这属性为当前的时间,菜鸟求救!!
出现如下错误:
1064-You have an error in your SQL syntax;check the manual that corresponds to your MySQL server version for the right syntax to use near 'leave =now () where id =1' at line 1请问如何修改这属性为当前的时间,菜鸟求救!!
sql 取当前时间的是 getdate()
update T set leave = getdate() where id =1
id integer not null auto_increment primary key,
stamp_created timestamp default '0000-00-00 00:00:00',
stamp_updated timestamp default now() on update now()
);
String command = "UPDATE `visitor` SET `leave`=(select now()) WHERE id= "+ id;我调用的是mysql中的函数,好纠结的语法问题,我是参考mysql的Navicat工具,然后生成语句
你在建表时应该处理过这个问题,
上面的语句改成 update t set `leave`=now() where id=1 就行。