这是我的数据库表,名为Cruise_Serial: enter image description here
我想获取每个cruiseID的总平均评价数,例如:
cruiseID 4013必须为:(5 + 5 + 4 + 4 + 3 + 4 + 4 + 5 + 4 + 4 + 4 + 4)/ 12 这是我为PreparedStatement编写的内容:
PreparedStatement ps = connect1.prepareStatement("SELECT CRUISE_SERIAL_NUMBER, AVG(CRUISE_SERIAL.EVALUATION_FOOD, CRUISE_SERIAL.EVALUATION_SEHEDULE, CRUISE_SERIAL.EVALUATIONA_COMFORTABLE,CRUISE_SERIAL.EVALUATION_TIDY),AVG(CRUISE_SERIAL_NUMBER) "
+ "FROM CRUISE_SERIAL GROUP by CRUISE_SERIAL_NUMBER");
但是此行代码中显示了错误,请帮助我解决问题。谢谢!
Exception in thread "main" java.sql.SQLSyntaxErrorException: Lexical error at line 1, column 21. Encountered: "\uff3f" (65343), after : "".
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ClientConnection.prepareStatement(Unknown Source)
at lab.User_Cruise.cruiseEvaluation
答案 0 :(得分:3)
您的某些下划线不是常规的,请在此处查看第二个:
CRUISE_SERIAL_NUMBER
错误告诉您,此 large 下划线是Unicode字符U + FF3F,即
只需将其替换为常规下划线即可。