我有以下查询,
SearchTemplate Template = new SearchTemplate();
Template.Criteria = DetachedCriteria.For(typeof(table1));
Template.Criteria.CreateCriteria("table2", "Usr", NHibernate.SqlCommand.JoinType.InnerJoin)
.SetProjection(Projections.ProjectionList()
.Add(Projections.Count("Usr.ID"), "UserCount")
.Add(Projections.GroupProperty("Location"), "ALocation")
.Add(Projections.GroupProperty("Company"), "ACompany")
.Add(Projections.GroupProperty("Usr.Designation"), "ADesignation"));
上面的查询给了我数据,
Location Company Designation Count
Florida A Manager 3
Florida A QA 5
Texas B Manager 6
Texas B QA 7
有没有办法改变查询,以便它提供数据,
Location Company Manager QA
Florida A 3 5
Texas B 6 7
这里 Manager 和 QA 是唯一可以进入指定字段的可能值。