> I have two tables whose structures are below.
> 
> - Table1 - 
> table1id int not null auto_increment
> data varchar(30)
> 
> - Table2 -
> table2id int not null auto_increment
> table1id int not null
> data varchar(30)
> 
> 
> These two tables are connected to each other with the 
> "table1id" column. I need to delete rows in table1 which have 
> no corresponding "table1id" values in table2 and also i need 
> to delete rows in table2 which have no corresponding 
> "table1id" values in table1. Any comments?

Can you try a multi table DELETE? I haven't done it but I would be a shot at
something like
(adapted from MySQL Manual)
DELETE t1 FROM t1,t2 WHERE t1.id=t2.id AND t2.id IS NULL

Adolfo


---------------------------------------------------------------------
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

Reply via email to