8,497
社区成员
发帖
与我相关
我的任务
分享
select case o.Status when 2 then o.SConfirmCount when 3 then o.HConfirmCount else 0 end Qty
from Stock_BookOrder o, Stock_BookOrderDetail d
where o.OrderCode=d.OrderCode
and d.ProductCode='54131' --- 商品
and Status in ('2','3') --- 2:分公司确认; 3:SAP确认
var query = from o in db.Stock_BookOrder
where new int[]{2, 3}.Contains(o.Status)
join d in db. Stock_BookOrderDetail.Where(x=>x.ProductCode == "54131")
on o.OrderCode equals d.OrderCode
select new
{
Qty =
{
o.Status == 2 ? o.SConfirmCount :
o.Status == 3 ? o.HConfirmCount :
0
}
};