Reputation: 325
I am new in nHibernate and i want to convert following sql query in nHibernate criteria
SELECT DISTINCT fReportID, fFiscalYear
FROM tFCMaster
WHERE fPropertyID='100'
I tried this:
Session.CreateCriteria<tFCMaster>().Add(Expression.Eq("fPropertyID", PropertyID))
.SetProjection(Projections.Distinct(Projections.Property("fFiscalYear")))
.List<tFCMaster>();
help will appreciated.
Upvotes: 0
Views: 1897
Reputation: 11
Try this one.
criteria.SetProjection(Projections.Distinct(Projections.Property("Country")));
Best Regards.
Upvotes: 1