我有这样的看法:
CREATE VIEW vwView
AS
SELECT
ac.ac_id
,ac.Company
,ac.no
,ac.ContractID
,ac.Seller
,ac.AcquistionDate
,ac.Village
,ac.Commune
,ac.Area
,ac.PlotArea
,ac.FieldNo
,ac.Topo1
,ac.Topo2
,ac.Topo3
,ac.Topo4
,ac.Topo5
,ac.TotalAreaSqm
,ac.OwnershipTitle
,ac.CadastralNO
,ac.Type
,ac.Price
,ac.NotaryCosts
,ac.LandTax
,ac.OtherTaxes
,ac.AgentFee
,ac.CadastralFee
,ac.TabulationFee
,ac.CertSarcini
,ac.ProcuraNO
,cast((isnull(ac.price,0)+isnull(ac.notarycosts,0)+isnull(ac.landtax,0)+isnull(ac.othertaxes,0)+isnull(ac.agentfee,0)+isnull(ac.cadastralfee,0)+isnull(ac.tabulationfee,0)+isnull(ac.certsarcini,0)) as decimal(12,4)) as TotalCosts
,cast((isnull(ac.price,0)+isnull(ac.notarycosts,0)+isnull(ac.landtax,0)+isnull(ac.othertaxes,0)+isnull(ac.agentfee,0)+isnull(ac.cadastralfee,0)+isnull(ac.tabulationfee,0)+isnull(ac.certsarcini,0))/(NULLIF(ac.TotalAreaSqm,0)/10000) as decimal(12,4)) as RonPerHa
,cast((isnull(ac.price,0)+isnull(ac.notarycosts,0)+isnull(ac.landtax,0)+isnull(ac.othertaxes,0)+isnull(ac.agentfee,0)+isnull(ac.cadastralfee,0)+isnull(ac.tabulationfee,0)+isnull(ac.certsarcini,0))/(NULLIF(ac.TotalAreaSqm, 0)/10000*NULLIF(ac.FixHist, 0)) as decimal(12,4)) as EurPerHa
,ac.DeclImpunere
,ac.FixHist
,cast((isnull(ac.price,0)+isnull(ac.notarycosts,0)+isnull(ac.landtax,0)+isnull(ac.othertaxes,0)+isnull(ac.agentfee,0)+isnull(ac.cadastralfee,0)+isnull(ac.tabulationfee,0)+isnull(ac.certsarcini,0))/NULLIF(ac.FixHist,0) as decimal(12,4)) as EurHist
,ac.LandStatus
,ac.Arenda
,UPDATE nbAchizitii set ac.Arenda=CASE WHEN ac.PlotArea=ar.PlotArea then 'yes'
else 'no'
END
FROM nbAchizitii ac
LEFT JOIN nbArenda ar
ON
ac.PlotArea=ar.PlotArea
我想在我的视图中包含应该动态执行的更新(它应该用是或否更新 ac.Arenda 的每一行)但我不知道应该如何将它放在视图中。有人可以帮我吗?