I have the folowing situation.
I want to retrieve a list of bids between time t1 and time t2. Then from this list i want to retrieve winning bid i.e maximum bid price.
I have written the following JPA query.
SELECT b FROM Bid b WHERE b.bidAmt = (SELECT MAX(b.bidAmt) FROM b WHERE b.lastUpdtTs BETWEEN ?1 AND ?2)
But I am getting the following exception.
Exception Description: Syntax error parsing the query [SELECT b FROM Bid b WHERE b.bidAmt = (SELECT MAX(b.bidAmt) FROM b WHERE b.lastUpdtTs BETWEEN ?1 AND ?2)], line 1, column 64: unexpected token [b].
Internal Exception: NoViableAltException(66!=[1108:1: subselectIdentificationVariableDeclaration[List varDecls] : ( identificationVariableDeclaration[varDecls] | n= associationPathExpression ( AS )? i= IDENT | n= collectionMemberDeclaration );])
Couls someone point out the mistake?