Solved

MySQL: Delete Instead of Select

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wifi connection to laptop without router windows 10 11 58
MySQL recovery 7 61
Add a date range function to PDF Generation 9 42
phpmyadmin memory error 55 95
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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