Solved

MySQL: Delete Instead of Select

Posted on 2011-09-08
2
238 Views
Last Modified: 2012-05-12
I use the SQL below to see the records I want to delete.  How can I delete the records that my SQL displays?
SELECT *
FROM `Group_Members`
INNER JOIN `Member` ON `Member`.`ID` = `Group_Members`.`MemberID`
WHERE `Group_Members`.`GroupID` = '6'
AND `Member`.`UserSuspended` = '1'
LIMIT 0 , 30

Open in new window

DeleteJoin.sql
0
Comment
Question by:hankknight
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
lisa_mc earned 500 total points
ID: 36503485
hi

This should do the trick but please try it on a test database first
DELETE a
FROM Group_Members a
inner join Member b
ON a.MemberID = b.ID  
WHERE
a.GroupID = '6'
AND b.UserSuspended = '1'

Open in new window

0
 
LVL 3

Expert Comment

by:lisa_mc
ID: 36503612
glad I could help thanks for the points :-)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now