On Thu, 1999-09-16 23:08:33 +0300, Tonu Samuel wrote:
> Craig Vincent wrote:
> > Is there any simple method of moving a record from one table to
> > another...
> > I have two tables (members & expired). Each with the same
> > columns. I want to move all records from members to expired that
> > have the value C or E in the cancel column.
> First suggestion is not to move expired accounts. Put the index on
> cancel column and check it in every query. Another ways all include
> many steps of collecting data, writing in another table and deleting
> from first one. At least two steps plus locking around it will be
> there :(.
LOCK TABLES members WRITE, expired WRITE;
INSERT INTO expired SELECT * FROM members WHERE ...;
DELETE FROM members WHERE ...;
And one always should check for errors, of course!
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26 E4 EC 80 58 7B 31 3A D7