hqf312429
hqf312429
采纳率0%
2018-12-20 16:16 阅读 1.1k

C#中sql语句如何转为Linq语句。

如何将下列Sql语句转为Linq语句

select 
t2.PROJECT_CODE as 项目号,t2.BOM_CODE as BOM编号,t1.PID as bom主表id, t1.id as BOM子表ID,t2.MAT_NAME as 项目产品,
t1.COMPONENT_CODE as 物料编码, t1.COMPONENT_QTY*t1.SET_NUMBER as 需求数量,
t3.ID as 备料表ID,t3.MAT_CODE as 备料表物料编码,t3.MAT_QTY as 备料数量,t3.STACKCODE  as 物料所在货位,

CASE WHEN t3.MAT_QTY=0 or t3.MAT_QTY is NULL THEN '未备'
WHEN t1.COMPONENT_QTY*t1.SET_NUMBER-t3.MAT_QTY<=0 THEN '备好了'
ELSE '备了部分' END as 状况
from  TAB_BOMS AS t1

left JOIN TAB_BOM AS t2 on t1.pid=t2.id

LEFT JOIN TAB_PRES AS t3 on t3.bomsid=t1.id  

where t2.PROJECT_CODE='TS56' 

order by 状况 asc
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐