sql话语转成linq
sql语句转成linq
select SUM(P.W) as w from order o left join product p on o.pid=p.ID where o.oid=100这个sql语句怎么转成Linq啊?求教
------最佳解决方案--------------------
你用LINQPAD
VLinq
http://www.alinq.org/en/default.aspx
可以转!
------其他解决方案--------------------
------其他解决方案--------------------
改下:
var query=(order.AsEnumerable().where(c=>c.oid==100)
join product.AsEnumerable() on order.Field<int>("pid") equals product.Field<int>("pid")
select product.Field<int>("w")).Sum();
------其他解决方案--------------------
------其他解决方案--------------------
有这个工具,但是不太会用啊
------其他解决方案--------------------
var query=(order.AsEnumerable().where(c=>c.oid==100)
join product.AsEnumerable() on order.Field<int>("pid") equals product.Field<int>("pid")
select product.w).Sum();
------其他解决方案--------------------
1楼哥们, ORDesigner 怎么用啊
------其他解决方案--------------------
select SUM(P.W) as w from order o left join product p on o.pid=p.ID where o.oid=100这个sql语句怎么转成Linq啊?求教
------最佳解决方案--------------------
你用LINQPAD
VLinq
http://www.alinq.org/en/default.aspx
可以转!
------其他解决方案--------------------
(from o in order
join p in product
on o.pid equals p.ID
into temp
from temp.DefaultIfEmpty
where o.oid==100
select temp.W).Sum(x=>x.W);
------其他解决方案--------------------
改下:
var query=(order.AsEnumerable().where(c=>c.oid==100)
join product.AsEnumerable() on order.Field<int>("pid") equals product.Field<int>("pid")
select product.Field<int>("w")).Sum();
------其他解决方案--------------------
var query = (from o in order.Where(x=>x.oid==100)
join p in product
on o.pid equals p.ID into t
from p in t.DefaultIfEmpty()
select p.W).Sum();
------其他解决方案--------------------
有这个工具,但是不太会用啊
------其他解决方案--------------------
var query=(order.AsEnumerable().where(c=>c.oid==100)
join product.AsEnumerable() on order.Field<int>("pid") equals product.Field<int>("pid")
select product.w).Sum();
------其他解决方案--------------------
1楼哥们, ORDesigner 怎么用啊
------其他解决方案--------------------