Hi,
I'm just wondering if I can do the string function Left(Field, length) using HQL?
For example, the select statement in SQL
SELECT Left(Lastname,1), Count(*)
FROM MyTable
GROUP BY Left(Lastname,1)
ORDER BY Left(Lastname,1)
I tried to do it but received the following error message:
undefined alias or unknown mapping: Left [select new countobj(Left(obj.LastName, 1), count(obj.ID)) from MyObj obj group by Left(obj.LastName, 1) order by Left(obj.LastName, 1)]
Will I able to accomplish this using HQL?
Thanks in advance.
|