怎么将这句SQL 转化成Linq语句啊 求大神
SQL语句:
select * from dbo.ebidding_order o
left join
(select oid,MAX(approvalTime) as approvalTime from dbo.ebidding_flow_internal where state=1 group by oid ) f
on o.oid=f.oid
LINQ是支持Lazy Loading的,所以你不懂的时候,是可以拆成N个你懂的LINQ语句。
var q1 = from c in db.ebidding_order select c; var q2 = from c in db.ebidding_flow_internal where c.state=1 select c; var q3 = from c in q2 group c by c.oid into g select new { oid= g.key, approvalTime=g.max(c=>c.approvalTime) }; var q = from c in q1 join d in q3 .... 这儿写left join,这个题目留给你自己Google吧。
谢谢大叔的 热心回答 问题已经解决了