27,579
社区成员
发帖
与我相关
我的任务
分享
insert into t_pmpt_cp select sub_ring_id ,@mac_id,,@proc_id,@ti_id from t_ring where 1 = 1 and ( (select COUNT(1) as num from t_pmpt_cp where sub_ring_id = sub_ring_id and proc_id = @proc_id and mac_id = @mac_id and ti_id = @ti_id )<1)
insert into
t_pmpt_cp select sub_ring_id ,@mac_id,@proc_id,@ti_id from t_ring
where
1 = 1
and
not exists
(select sub_ring_id from t_pmpt_cp where sub_ring_id = sub_ring_id
and mac_id = ,@mac_id and proc_id = @proc_id and ti_id =@ti_id)
insert into t_pmpt_cp select sub_ring_id ,@mac_id,,@proc_id,@ti_id from t_ring a
where not exists(select 1 form t_pmpt_cp where id=a.sub_ring_id --假设以id列作比较,如果有ID相同则为存在
and ( (select COUNT(1) as num from t_pmpt_cp where sub_ring_id = sub_ring_id and proc_id = @proc_id and mac_id = @mac_id and ti_id = @ti_id )<1)