有人可以解释一下这个查询有什么问题吗?
SELECT Attempts, (CASE WHEN LastLogin IS NOT NULL AND DATE_ADD(LastLogin, INTERVAL 1 MINUTE)>NOW() THEN 1 ELSE 0) AS Denied
FROM tbl_loginLocks
WHERE IP = "192.168.178.43";
我收到一条操作丢失的错误。 任何帮助,将不胜感激。 谢谢!
答案 0 :(得分:1)
您在END
:
CASE
SELECT Attempts, (CASE WHEN LastLogin IS NOT NULL AND DATE_ADD(LastLogin, INTERVAL 1 MINUTE)>NOW() THEN 1 ELSE 0 END) AS Denied
FROM tbl_loginLocks
WHERE IP = '192.168.178.43';
或者,使用IIF声明:
SELECT Attempts, IIF(LastLogin IS NOT NULL AND DATEADD("n", 1, LastLogin) >NOW(), 1, 0) AS Denied
FROM tbl_loginLocks
WHERE IP = '192.168.178.43';
答案 1 :(得分:1)
在 CASE 声明的末尾添加结束
Date_Add 功能错误
Microsoft Access DateAdd 函数返回添加了特定时间/日期间隔的日期。
<强>语法强>
Microsoft Access DateAdd函数的语法是:
DateAdd ( interval, number, date )
试试这个
SELECT Attempts, (CASE WHEN LastLogin IS NOT NULL AND DateAdd ("n",1,LastLogin)>NOW() THEN 1 ELSE 0 END) AS Denied
FROM tbl_loginLocks
WHERE IP = "192.168.178.43";
答案 2 :(得分:1)