我需要帮助将此查询从LINQ语法转换为SQLServer查询语法:
var t1 = (from p in db.Varors join
op in db.OrderVarors on p.id equals op.IdVara
where op.IdOrder == OrderId
select p).ToList();
答案 0 :(得分:1)
您可能希望选择单个列而不是星号,但这应该有效。
select *
from dbo.Varors as P
join dbo.OrderVarors as OP
on p.id equals op.IdVara
where op.IdOrder = OrderId
答案 1 :(得分:1)
希望这会有所帮助: -
SELECT v.* from Varors v
JOIN ordervarors ov on v.id = ov.id
where ov.idOrder == @OrderId
答案 2 :(得分:0)
这是一个简单的加入 - 试试这个:
select Varors.*
from Varors
join OrderVarors on Varors.id = OrderVarors.IdVara
where OrderVarors.IdOrder = @OrderId