使用JDBC的Java中SQL命令中的语法错误

时间:2019-02-26 16:11:33

标签: java sql

此命令在执行时出现语法错误,当我添加ORDER BY条件时显示该错误

"SELECT * FROM `reservation`  WHERE event_id IN (SELECT id FROM event WHERE user_id = 3 ") ORDER BY dateReservation

2 个答案:

答案 0 :(得分:0)

您必须在语句末尾用双引号引起来。

答案 1 :(得分:0)

应该是:

"SELECT * FROM reservation  WHERE event_id IN (SELECT id FROM event WHERE user_id = 3 ) ORDER BY dateReservation"