开发者

SQL query to linq syntax

How can i convert this join stmnt to linq syntax

SELECT pv.Product_ID, pv.Product, v.Add_ID, v.Product_ID
  FROM Product AS pv 
  JOIN Product_Add AS v
  ON ((pv.Product_ID = v.Add_ID) OR (p开发者_运维知识库v.Product_ID = v.Product_ID))
     where(( pv.Product_ID = v.Product_ID) OR (pv.product_ID = v.Add_ID))

Thanks


I would convert this for you

but its better you use this tool which is really help full to me to convert sql to linq code

http://www.sqltolinq.com/

just download and install on your machine will do work for you.


Instead of Join, you can use from...where, it's the same thing.

from pv in Product
from v in Product_Add
where ((pv.Product_ID == v.Add_ID) || (pv.Product_ID == v.Product_ID))
     &&(( pv.Product_ID = v.Product_ID) || (pv.product_ID = v.Add_ID))

(You just AND all the join conditions with the rest of the where if you have multiple joins)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜