hello,
i have a table A with a field B
and what i want seems to work in SQL but not in HQL or which syntax can i use?
SQL:
SELECT MAX(B) FROM (
SELECT MAX(a.B) FROM A a WHERE .. GROUP BY .. HAVING sum(C) > 0
)
because of a GROUP BY + HAVING, i get several result-groups
but i need only one overall-MAX
in HQL "FROM (" leads to a syntax-error
and even if it would work, how to name the field?
-----------
at writing, i have tested another solution,
SELECT MAX(a.B) FROM A a WHERE .. AND 0 < (SELECT subquery)
works, but is slow because of the subquery..
_________________ Hansa wird Meister.
|