insert into sms(id) where t1.id = t2.id or t1.name = t2.name⼀⼀这条语句对吗?

2024-11-23 14:59:21
推荐回答(2个)
回答1:

楼主 都不对 一个是插入 一个是条件 没有查询语句
insert into sms(id)
select id from tb
where t1.id = t2.id
--or t1.name = t2.name

回答2:

you can try this :
1.table sms must not exist!
select t1.id into sms from t1,t2 where t1.id = t2.id or t1.name = t2.name
2.table sms must be existing!
insert into sms(t1.id) select t1.id from t1,t2 where t1.id = t2.id or t1.name = t2.name