我在下面的查询中得到以下错误:
#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 ')))' at line 1
代码片段:
INSERT INTO test_bans( ip, Expiration )
VALUES (
"0.0.0.0", DateAdd(
"d", 1, Date( )
)
)
建表查询
CREATE TABLE test_bans (
ID smallint(6) NOT NULL AUTO_INCREMENT,
IP text NOT NULL,
Expiration DATETIME NOT NULL,
PRIMARY KEY (ID)
) TYPE=MyISAM;
我错过了什么?
编辑,运行这个查询后我得到了这个错误。我想我的新问题是如何在当前时间戳中添加一天?
#1305 - FUNCTION optimuscprime.DateAdd does not exist
查询:
INSERT INTO test_bans( ip, Expiration )
VALUES (
"0.0.0.0", DateAdd(
"d", 1,
CURRENT_TIMESTAMP
)
)
最佳答案
尝试使用简单的 SQL,而不是 MySQL 方言:
INSERT INTO test_bans( ip, Expiration )
VALUES (
'0.0.0.0', (NOW() + INTERVAL 1 DAY)
);
关于mysql - mySQL 查询中的错误#1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2533562/