Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下查询(名称已简化):
SELECT A.VAL1, A.VAL2 FROM TABLE1 A, TABLE2 B WHERE A.VAL2=B.VAL2 AND A.BEGIN_DATE < CURRENT_DATE() AND A.END_DATE > CURRENT_DATE() AND B.VAL2=1
我得到“SQL 命令未正确结束”,但是,如果我删除第 4 行和第 5 行,它会完美运行。
两条日期线搞砸了怎么办?谢谢你的帮助
更新**对不起。是的,这是甲骨文
您应该使用 CURRENT_DATE 而不是 CURRENT_DATE()
在 MYSQL 你有CURDATE()当前日期
CURDATE()
SELECT A.VAL1, A.VAL2 FROM TABLE1 A, TABLE2 B WHERE A.VAL2=B.VAL2 AND A.BEGIN_DATE < CURDATE() AND A.END_DATE > CURDATE() AND B.VAL2=1