Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MySQL: Delete Instead of Select

Posted on 2011-09-08
2
Medium Priority
?
245 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

660 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