我正在运行折旧数据库。我需要在下个月运行折旧,其中必须满足两个条件但来自不同的表
insert into Asset.dbo.depreciation (Asset_Tag, depreciation_date, Depreciation_Amount)
select
Asset_Tag, '2012-05-01', Depreciation_Amount
from Asset.dbo.depreciation
where depreciation_date = '2012-04-01'
and asset_details.Fully_Depreciated = 'N'
and
来自另一个表后的条件。
请帮忙
答案 0 :(得分:1)
你错过了加入其他桌子 例如:
Asset.dbo.depreciation d INNER JOIN Asset.dbo.Asset_details d2 ON d1.keycolumn = d2.keycolum where d.depreciation_date = '2012-04-01' and d1.Fully_Depreciated = 'N'