Have you already tried to use the join syntax?
http://www.hibernate.org/hib_docs/v3/re ... yhql-joins
Well, I just read again what you wrote:
Quote:
But in fact I need "as" because I want to have an "order by" statement for one of the attributes I am querying for.
I think it's not possible to reuse an alias of the select clause in the order by clause. Sounds strange, but as far as I can remember at least Oracle was not able to do this.
Example:
Code:
SELECT foo, sum(foo2) as foo3
FROM bar
ORDER BY foo3;
You'll have to repeat the expression.
Code:
SELECT foo, sum(foo2)
FROM bar
ORDER BY sum(foo2);
Though, an expression is not allowed in the order by clause for some databases (e.g. MySQL).
If you're sure, whether your database can handle such a case, you might think about the need for an alias after sum(..).
However, I'd also be interested in getting to know why it does not work...
Best regards
Sven