Everything that is not in AA but is in MAIN I want put into CC
Everything that is not in MAIN but is in AA I want put into DD
Add everything in DD to MAIN
Clear AA CC and DD
Thanks in advanceWhen you say put, do you mean copy or move?|||What is the purpose of CC, it doesn't seem to determine anything and then it
gets cleared?
INSERT cc
SELECT main.*
FROM main
WHERE main.rowid NOT IN (SELECT rowid from aa)
INSERT dd
SELECT aa.*
FROM aa
WHERE aa.rowid NOT IN (SELECT rowid from main)
INSERT main
SELECT * from dd
DELETE aa
DELETE cc
DELETE dd
--
*************************************
Andy S.
andy_mcdba@.yahoo.com
*************************************
"Chris Petersen" <petersen_cp@.hotmail.com> wrote in message
news:d1bad213.0309151616.3140d739@.posting.google.c om...
> I have 4 tables (AA,MAIN,CC,DD)
> Everything that is not in AA but is in MAIN I want put into CC
> Everything that is not in MAIN but is in AA I want put into DD
> Add everything in DD to MAIN
> Clear AA CC and DD
> Thanks in advance|||I have 4 tables (AA,MAIN,CC,DD)
Everything that is not in AA but is in MAIN I want put into CC
Everything that is not in MAIN but is in AA I want put into DD
Add everything in DD to MAIN
Clear AA CC and DD
insert into CC select * from MAIN
delete C from CC c join AA a on a.ID = c.ID
insert into DD select * from AA
delete d from DD d join MAIN a on a.ID = d.ID
truncate table AA (etc)
No comments:
Post a Comment