1
People need to create a query with queryOver(Nhibernate) C#, to add more than one column. Example in pure sql:
SELECT SUM(coluna1 + coluna2 + coluna3 + coluna4)
FROM tabela
First I did so:
Tabela tabela = null;
Session.QueryOver<Tabela>(() => tabela)
.Select(Projections.Sum<Tabela>(t => t.coluna1))
.Select(Projections.Sum<Tabela>(t => t.coluna2))
.Select(Projections.Sum<Tabela>(t => t.coluna3))
.Select(Projections.Sum<Tabela>(t => t.coluna4))
But this way we sum each column and generates 4 columns, I would like to sum all and generate only one column.
Just what I needed, it worked right, thanks for the help!
– Marcos Vinicius