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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PortletPaulEE Topic AdvisorCommented:
are you sure this works?  delete table1 from table2 where table1.field=table2.field it looks invalid to me.

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?
robrodpProgrammerAuthor Commented:
delete b2x1 from borrarproc where

Just deleted 1333 see attached screenshot. And yes it is just deleting rows in table 1
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:

delete table1.* from table1
inner join table2
on table1.field=table2.field

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
in your later example, apply this:

delete b2x1.* from b2x1
inner join borrarproc

Open in new window

if you want to delete records from table b2x1 which matched condition with table: borrarproc
Dorababu MSenior Software EngineerCommented:
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

Open in new window

robrodpProgrammerAuthor Commented:
Worked like a charm

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.