0
Get max between two numbers in jpql
I want to use @NamedQuery that give the max number of a column between two numbers. For example I want 12 from below: 1 2 8 10 12 // I want this 13 15
1 Odpowiedź
+ 1
write this in namedquery:
“select max(e.id) from entity e where e.id between :minValue and :maxValue”
then:
Query q =createNamedQuery(“name”)
q.setparameter(“minValue, 1);
q.setparameter(“maxValue, 20);