into table1 select * from table2,table3 where table2.dw <> table3.dw and table3.fhdate <> table3.fhdate
我要的是: table1.dw<>table2.dw and table1.dw<>table3.dw etc..怎么做???table1在条件也是存在的。
insert into table1 select * from table2 where table2.dw not in (select dw from table1) insert into table1 select * from table3 where table3.dw not in (select dw from table1)
把问题说详细点 如果是TABLE1、TABLE2、TABLE3的结构都相同,只是要把DW和FHDATE都不相同的记录都COPY进去而已那就这样写分两次: insert into table1 select * from table2 where (table2.dw not in (select dw from table1) insert into table1)and (table2.fhdate not in (select fhdate from table1)) select * from table3 where (table3.dw not in (select dw from table1) )and(select table3.fhdate not in (select fhdate from table3))
table1.dw<>table2.dw and table1.dw<>table3.dw etc..怎么做???table1在条件也是存在的。
select * from table2 where table2.dw not in (select dw from table1)
insert into table1
select * from table3 where table3.dw not in (select dw from table1)
如果是TABLE1、TABLE2、TABLE3的结构都相同,只是要把DW和FHDATE都不相同的记录都COPY进去而已那就这样写分两次:
insert into table1
select * from table2 where (table2.dw not in (select dw from table1)
insert into table1)and (table2.fhdate not in (select fhdate from table1))
select * from table3 where (table3.dw not in (select dw from table1)
)and(select table3.fhdate not in (select fhdate from table3))