Solved

MySQL: Delete Instead of Select

Posted on 2011-09-08
2
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

635 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