我正在尝试计算百分比,但编译器一直告诉我它不需要斜杠和第三个 select 语句。
Query query = session.createQuery("SELECT
(SELECT COUNT(*) FROM Reservation r WHERE r.begin BETWEEN :start AND :end)
/
(SELECT COUNT(*) FROM Reservation res WHERE res.begin BETWEEN :start AND :end AND res.contract IS NOT NULL) * 100");
当我尝试运行它时,它给了我这个错误:
Exception in thread "main" org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree
我究竟做错了什么?提前致谢!