我怎么能说出下面的MySQL查询在JPQL转换MySQL查询JPQL查询
select * from Price WHERE `valueDate` = (SELECT MAX(`valueDate`) FROM Price) and fundId = 2930
我曾尝试如下:这种办法
"select a from Price a where a.valueDate = select MAX(a.valueDate) and a.fund.id = :" +Price.QUERY_PARAM_FUND_ID
,但得到的错误:
Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: "Encountered "MAX" at character 50, but expected: ["AND", "GROUP", "HAVING", "OR", "ORDER", <EOF>]." while parsing JPQL "select a from Price a where a.valueDate = select MAX(b.valueDate) from Price b and a.fund.id = :fundId"
请显示一些努力,显示你已经尝试过。人们会更热衷于帮助,而你的问题更可能保持不变。 – Magnilex 2014-09-30 11:21:19
你好,我已经添加了我的尝试。感谢您的回复 – 2014-09-30 11:24:45
错误是什么?你能把它粘贴在这里吗? – 2014-09-30 11:28:08