我正在努力将查询从sql转换为实体linq。我的选择应该是prodhis.stock_units_free的总和减去prodhis.stock_units_it的总和
有人能指出我正确的方向吗?
这就是我所拥有的
Dim res As Integer = (From it In rmis.product_detail Join prodhis In rmis.PRODUCT_HISTORY On it.SKU_ID Equals prodhis.SKU_ID _
Where prodhis.WEEK_SELECTOR = cws AndAlso
it.POS_CODE = ItemID AndAlso
prodhis.BRANCH_ID = 23
'Stuck Here:
Select (sum(prodhis.STOCK_UNITS_FREE) - sum(prodhis.STOCK_UNITS_IT))
Sum未声明错误....
由于
答案 0 :(得分:1)
将您的选择更改为:
Select prodhis.STOCK_UNITS_FREE - prodhis.STOCK_UNITS_IT).Sum();