-1

我运行一个折旧数据库。我需要在必须满足两个条件但来自不同表的下个月进行折旧

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来自另一个表。

请帮忙

4

1 回答 1

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'

于 2012-06-12T16:03:17.070 回答