select a.col1, b.col2, c.col3 into table4 from tableA a, tableB b, tableC c where 1 = 0
如果表存在的话,那就用 insert into 表4 select a.字段1,b.字段2,c.字段3 from 表A a,表B b,表C c where 条件如果表4不存在 select a.字段1,b.字段2,c.字段3 into 表4 from 表A a,表B b,表C c where 条件
如果表存在的话,那就用insert into 表4 select a.字段1,b.字段2,c.字段3 from 表A a,表B b,表C c where 条件 ------------------------------------------------------------------------------->好像不行啊,我的条件写的是:1<>1表4中没有增加所需的字段。
into table4
from tableA a, tableB b, tableC c
where 1 = 0
insert into 表4 select a.字段1,b.字段2,c.字段3 from 表A a,表B b,表C c where 条件如果表4不存在
select a.字段1,b.字段2,c.字段3 into 表4 from 表A a,表B b,表C c where 条件
------------------------------------------------------------------------------->好像不行啊,我的条件写的是:1<>1表4中没有增加所需的字段。
----------条件是什么意思?
----------条件是什么意思?
--------------------相当于1=0
*
into 表5
from
表4 m
left join
(select a.字段1,b.字段2,c.字段3 from 表A a,表B b,表C c where 1<>1) n
on
1=1drop table 表4exec sp_rename '表5','表4'
---------------------->如果表中有重复的字段该怎么办呢?