I running a depreciation database. I need to run depreciation for the next month where two conditions have to be met but from different table
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'
The condition after the and comes from another table.
Please help
you are missing join to other table
ex:
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'