0
我想显示在名字服务简单连接语法不正常
- 服务(代码名)
- 历史(ID,密码分组的历史表中的记录数,。 ...)
请注意,这两个表的历史和服务之间没有任何关系,从历史
我已经测试过这个sql查询的其他表独立门店活动d返回预期的结果:
select s.name, count(*) from history c
join service s
on c.code=s.code
where c.state='INITIALE'
group by s.name
其实,我想它写在JPQL,我也一样
Query query =entityManager.createQuery(" select s.name, count(*) from ServiceEntity s join"
+ " HistoryEntity c "
+ " where c.code=s.code and c.state='INITIALE'"
+ " group by c.name order by c.name"
);
我得到这个错误:路径预期的加入! ... 无效的路径:“c.code” ....二元运算符的右侧操作数是子树的空....意外结束
这两个查询使用不同的表。第一个查询使用'service'和'history'表,而第二个查询使用'ServiceEntity'和'HistoryEntity'表。在查询工具(如SQL * Plus或SQL Developer)中测试第二个查询时会发生什么?它是否正确执行? – 2015-04-06 11:38:52