我该怎么写这样的查询:
SELECT SUM(c2) sum_c2, SUM(c3) sum_c3, SUM(c4) sum_c4 FROM tableT1 WHERE c1 = 'blablabla'
使用NHibernate(Linq或QueryOver或Criteria) 得到一维的数组?
答案 0 :(得分:0)
tableT1.Where(t=>t.c1=="blablabla")
.GroupBy(t=>1)
.Select(g=>new{sum_c2=g.Sum(x=>x.c2),sum_c3=g.Sum(x=>x.c3),sum_c4=g.Sum(x=>x.c4)});