Copy to new table and also delete from old Table

  • Thread starter Thread starter LionFast
  • Start date Start date
L

LionFast

Hi, the following query would select all rows where done=true and copy it to
the TaskDone table. But how do I also remove it from the Task table after
the copy procedure???? Give me REMOVE codes. Thanks




INSERT INTO TaskDone
SELECT *
FROM Task
WHERE Done=True;
 
LionFast said:
Hi, the following query would select all rows where done=true and copy it to
the TaskDone table. But how do I also remove it from the Task table after
the copy procedure???? Give me REMOVE codes. Thanks




INSERT INTO TaskDone
SELECT *
FROM Task
WHERE Done=True;

DELETE FROM TaskDone
Where Done=True;

Cheers,
Randy
 
Hi, the following query would select all rows where done=true and copy it to
the TaskDone table. But how do I also remove it from the Task table after
the copy procedure???? Give me REMOVE codes. Thanks




INSERT INTO TaskDone
SELECT *
FROM Task
WHERE Done=True;

I would STRONGLY suggest an alternative approach. You're storing data
redundantly in two tables; you may want to consider just having *one*
table, Task. YOu can easily put a nonunique Index on the [Done] field,
and then create two Queries - TasksDone selecting those records where
that field is True, TasksToDo selecting False.

John W. Vinson[MVP]
 
Back
Top