问题
I'm trying to translate the following SQL statement into Nhibernate query using Criteria or QueryOver but it's not working!! the SQL command is:
select Count(*)
from
(
select distinct col1, col2, col3
from tableName
where col1 like '%t%' or col4 like '%t%'
) As x
It either counts the results were's no projection applied, or it gives me a run-time error regards using this
query.SetProjection(Projections.Count(Projections.Distinct(
Projections.ProjectionList()
.Add(Projections.Property("col1"))
.Add(Projections.Property("col2"))
.Add(Projections.Property("col3"))
)));
Can anyone help me please?
Thanks
来源:https://stackoverflow.com/questions/19812544/translate-sql-command-to-nhibernate-linq-using-criteria-or-queryover-count-res