27,580
社区成员
发帖
与我相关
我的任务
分享
insert into 收费表 select * from 中间表 a where not exists(select 1 from 收费表 where 房号=a.房号 and 应交月份=a.应交月份)
insert into 收费表 select * from 中间表
where 中间表.房号 not in (select 收费表.房号 from 收费表 )
and 中间表.应交月份 not in (select 收费表.应交月份 from 收费表 )
---try
insert into
收费表(房号,收费项目,应交月份)
select
房号,收费项目,应交月份
from
中间表
where
中间表.房号
not in
(select 收费表· 房号 from 收费表 )
and
收费表.应交月份
not in
(select 收费表.应交月份 from 收费表)