Solved

MySQL: Delete Instead of Select

Posted on 2011-09-08
2
239 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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: …
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 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

14 Experts available now in Live!

Get 1:1 Help Now