robrodp
asked on
delete records form a mysql table
In ms sql
delete table1 from table2 where table1.field=table2.field
Works ok
How can I do the same for 2 tables in mysql
Any ideas
delete table1 from table2 where table1.field=table2.field
Works ok
How can I do the same for 2 tables in mysql
Any ideas
ASKER
delete b2x1 from borrarproc where b2x1.email=borrarproc.emai l
Just deleted 1333 see attached screenshot. And yes it is just deleting rows in table 1
Just deleted 1333 see attached screenshot. And yes it is just deleting rows in table 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
in your later example, apply this:
if you want to delete records from table b2x1 which matched condition with table: borrarproc
delete b2x1.* from b2x1
inner join borrarproc
on b2x1.email=borrarproc.email
if you want to delete records from table b2x1 which matched condition with table: borrarproc
May be you need to write something like this
DELETE t1,t2,t3 FROM table1 as t1
JOIN table2 as t2 ON t2.ID = t1.ID
JOIN table3 as t3 ON t3.ID = t1.ID
ASKER
Worked like a charm
Thx
Thx
Perhaps you could paste in the actual sql being used?
also, what is the extra query supposed to do, is it still just deleting rows in table1?