code_junkie

ordering by collection count in nhibernate

Nov 12th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. List<Question> list = nhelper.NHibernateSession
  2. .CreateQuery("Select q from Question q left join q.Answers a group by q,a order by count(a)")
  3. .List<Question>();
  4.  
  5. "column Question.Name is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause"
  6.  
  7. Question.Users.UserId
  8.  
  9. var sort = from n in c
  10. orderby q.Answers.Count
  11. select n;
Add Comment
Please, Sign In to add comment