I have that query :
var group = query.GroupBy(x => new
{
...
TestName = isSelected ? x.ClassA.Name : ""
});
var select = group.Select(y => new MyResultDTO()
{
...
TestName = isSelected ? y.First().ClassA.Name : ""
});
That is not woriking … I got an error :
Column ‘tblClassA.Name’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
But if I change my groupBy to only (take of condicional clause):
TestName = x.ClassA.Name
It works fine…
Any idea how can I do that condicional GroupBy/Select ?
I´m using NHibernate 3.3.1
Paul
Not sure of what you want to achieve, but have you tried writing ?
Also, you may try something like this for your group :
Hope this will help