Re: Purging records

2002-01-16 Thread Diana Soares

Hi, 
Because i don't like the mysql DELETE syntax, i prefer using this quick
method:

% create a new table = table1
CREATE TABLE Table3 (...)

% insert into table3 the records from table1 that aren't in table2
INSERT INTO Table3 (Table3.fields) 
SELECT Table1.fields 
FROM Table1 LEFT JOIN Table2 USING (id) 
WHERE Table2.id IS NULL

% remove table1
DROP TABLE Table1

% rename table3 to table1
RENAME TABLE Table3 TO Table1;


On Tue, 2002-01-15 at 22:32, SNK wrote:
 Hi , I would need help with the syntax for this:
 
 I have Table1 and Table2. Table2 consists only of records that also exist in
 Table1 (duplicates), and I wish to delete all the records in Table1 that are
 matched in Table2, while keeping the rest of the records in Table1 intact.
 Can anyone help?
 
 Thanks very much in advance.
 
 Fers, Buenos Aires - Argentina.
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
-- 
Diana Soares


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Purging records

2002-01-15 Thread SNK

Hi , I would need help with the syntax for this:

I have Table1 and Table2. Table2 consists only of records that also exist in
Table1 (duplicates), and I wish to delete all the records in Table1 that are
matched in Table2, while keeping the rest of the records in Table1 intact.
Can anyone help?

Thanks very much in advance.

Fers, Buenos Aires - Argentina.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php