I would like to execute with NHibernate a query like this:
Code:
select convert(varchar(10), PaymentDate, 105)
from order
group by convert(varchar(10), PaymentDate, 105)
This query returns all unique PaymentDates from the Order table in a shortdate format:
15-12-2008
16-12-2008
21-12-2008
...
...
I can execute native SQL with NHibernate, but I would like to do this with HQL or with a Criteria Query, something like this:
Code:
IQuery query = session.CreateQuery("select convert(varchar(10), o.PaymentDate, 105) from Order o group by convert(varchar(10), o.PaymentDate, 105)");
I don't know how to convert or cast a datetime with HQL, and I can't find it anywhere.
Does anyone know how to solve this with NHibernate?[/code]