2018-05-05

update bh20180502.dbo.PayModeInfo set Valid=t.Valid
from bh20180502.dbo.PayModeInfo a inner join bh20180420.dbo.PayModeInfo t on a.ID=t.ID

 

-- 追踪类型

insert into TrackCategory
select * from bh.dbo.TrackCategory

insert into TrackInfo
select * from bh.dbo.TrackInfo

 

-- 更新积分, 加了isnull
with t
as
(
select FID,
isnull(mJFTotal, 0) as jf,
b.Now as currID
from H_TMK a, bh20180420.dbo.CustomerBaseInfoID b where a.FID=b.Original
)
update AccountsOfCustomer set IntegrationBalance=t.jf
from AccountsOfCustomer
inner join t on AccountsOfCustomer.CustomerID=t.currID