我收到错误错误:语法错误在“(”
处或附近String deleteSQL = "DELETE FROM customer" +
"WHERE (fname = 'Fred' AND lname = 'Flintstone')" +
"OR (fname = 'Barney' AND lname = 'Rubble')";
System.out.println("Records deleted: "
+ stmt.executeUpdate(deleteSQL));
答案 0 :(得分:5)
String deleteSQL = "DELETE FROM customer " +
"WHERE (fname = 'Fred' AND lname = 'Flintstone') " +
"OR (fname = 'Barney' AND lname = 'Rubble') ";
System.out.println("Records deleted: "
+ stmt.executeUpdate(deleteSQL));
问题是在结合时缺少空格。
想象一下:
“word”+“word2”
这会导致"wordword2"
所以它应该是
"word" + " " + "word2"
或 "word "+ "word2"