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

PortletPaulfreelancerCommented:
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?
0
robrodpAuthor Commented:
delete b2x1 from borrarproc where b2x1.email=borrarproc.email

Just deleted 1333 see attached screenshot. And yes it is just deleting rows in table 1
0
Ryan ChongCommented:
try:

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

Open in new window

0

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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Ryan ChongCommented:
in your later example, apply this:

delete b2x1.* from b2x1
inner join borrarproc
on b2x1.email=borrarproc.email

Open in new window


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

0
robrodpAuthor Commented:
Worked like a charm

Thx
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.