创建视图[dbo]。[Item_WHS_PRICE]作为选择T0。[ItemCode],T0。[WhsCode],sum(T0。[StockValue])/sum(T0。[OnHand])as StockPrice from OITW T0 WHERE T0 。[OnHand]> 0 GROUP BY T0。[ItemCode],T0。[WhsCode] GO
按以下方式使用查询视图
选择T1。[ItemCode],T1。[OnHandQty],t3.StockPrice AS'UNIT_COST',T1。[OnHandQty] * t3.StockPrice AS STOCKVALUE,'AUD'作为货币,T2。[BinCode]作为LOCATION_ID从 [dbo]。[OIBQ] T1的内部联接OBIN T2在T1上。BinAbs= T2.AbsEntry T1的内部联接dbo.item_whs_price T3.ItemCode = t3.itemcode和t1.whscode = t3.whscode WHERE T1。[OnHandQty]> 按T1.ItemCode排序
这是一个两步过程。
第1步,创建如下所示的视图
创建视图[dbo]。[Item_WHS_PRICE]作为选择T0。[ItemCode],T0。[WhsCode],sum(T0。[StockValue])/sum(T0。[OnHand])as StockPrice from OITW T0 WHERE T0 。[OnHand]> 0 GROUP BY T0。[ItemCode],T0。[WhsCode] GO
按以下方式使用查询视图
选择T1。[ItemCode],T1。[OnHandQty],t3.StockPrice AS'UNIT_COST',T1。[OnHandQty] * t3.StockPrice AS STOCKVALUE,'AUD'作为货币,T2。[BinCode]作为LOCATION_ID从 [dbo]。[OIBQ] T1的内部联接OBIN T2在T1上。BinAbs= T2.AbsEntry T1的内部联接dbo.item_whs_price T3.ItemCode = t3.itemcode和t1.whscode = t3.whscode WHERE T1。[OnHandQty]> 按T1.ItemCode排序
一周热门 更多>