0
我想在select語句中使用子查詢,但我想將列數據傳遞給子查詢,以便它可以過濾正在處理的行的數據。我們如何做到這一點,甚至有可能?如何在內部查詢條件中使用外部查詢列
select
[SRP Code], [Master Code], [Product Desc], [Pack Desc],[Information], [Store],
case when ([SRP Code] <> [Master Code])
then
isnull([38],0) + (select (e.stock/er.unit) as 'Stock' from erp_stock e join
erpcustomerlinking er on e.productcode = er.mastercode where
er.mastercode = [Master Code] <-- here I want the column
and weekno = 38 group by e.stock,er.unit)
else
isnull([38],0)
end as [38],[36],[37],[35],[39],[40],[41],[42],[43],[44],[45],[46],[47],[48],[49],[50]
from [dbo].[F91FE39A-F618-40A8-A6F7-C721A379EE76]
where [SRP Code] = 401794
非常感謝你:) – Rohit 2014-10-03 09:08:57