说的比较拗口
我简单的写一个思路(伪代码),没有验证,仅供参考,不知道理解是否对:
insert into b
select * from c
where c.pk in (
select b.cpk1 from b,a where b.pk=a.pk and a.pk='xxx'
union all
select b.cpk2 from b,a where b.pk=a.pk and a.pk='xxx'
union all
select b.cpk3 from b,a where b.pk=a.pk and a.pk='xxx'
union all
select b.cpk3 from b,a where b.pk=a.pk and a.pk='xxx'
)
思路是,通过a,b表关联得到4个字段内的所有记录,然后更具这个id集合在c里面查询出所有记录,然后插入b中。
family as water