22,210
社区成员
发帖
与我相关
我的任务
分享
declare @表a table (UUID int,APP_LINE_ID int)
insert into @表a
select 87219,513131
declare @表ca table (ASSET_ID int,APP_LINE_TF_ID int,APP_LINE_TK_ID int)
insert into @表ca
select 87219,494386,0 union all
select 87219,513131,0
declare @表ar table (RELATION_ID int,ASSET_ID int,EVENT_TYPE int)
insert into @表ar
select 494386,87219,1507 union all
select 494386,87219,1507 union all
select 513198,87219,1508 union all
select 513198,87219,1508 union all
select 513131,87219,1507 union all
select 513131,87219,1507
select * from @表a
select * from @表ca
select * from @表ar
update @表ca set APP_LINE_TF_ID=(select top 1 relation_id from @表ar where EVENT_TYPE='1507') where APP_LINE_TF_ID!=(select APP_LINE_ID from @表a)
update @表ca set APP_LINE_TK_ID=(select top 1 relation_id from @表ar where EVENT_TYPE='1508') where APP_LINE_TF_ID!=(select APP_LINE_ID from @表a)
select * from @表ca
declare @表a table (UUID int,APP_LINE_ID int)
insert into @表a
select 87219,513131
declare @表ca table (ASSET_ID int,APP_LINE_TF_ID int,APP_LINE_TK_ID int)
insert into @表ca
select 87219,494386,0 union all
select 87219,513131,0
declare @表ar table (RELATION_ID int,ASSET_ID int,EVENT_TYPE int)
insert into @表ar
select 494386,87219,1507 union all
select 494386,87219,1507 union all
select 513198,87219,1508 union all
select 513198,87219,1508 union all
select 513131,87219,1507 union all
select 513131,87219,1507
select * from @表a
select * from @表ca
select * from @表ar