0

如何对实体框架执行此 sql 查询?

select 
id,
column1,
column2 =  case when (select max(column2) from table1 b where b.id = a.id) = a.column2 
then 'Positive' else 'Negative' end
from table1 a
4

1 回答 1

1
var query = from t in context.table1
            let column2_temp = context.table1.Where(p=>p.id==t.id).Max(p=>p.column2)
            let column2 = column2_temp == t.column2? "Positive" : "Negative"
            select new {t.id, column2}
于 2013-10-19T18:34:17.920 回答