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
Solved

MySQL Delete records

Posted on 2011-09-08
6
248 Views
Last Modified: 2012-05-12
I have a table called TableA that has a column called 'status' .  I need to delete all records where in the table that do not match a status of A-Active or AC-Active.

Can someone give me the proper MySQL command to do this?
0
Comment
Question by:pda4me
6 Comments
 
LVL 8

Accepted Solution

by:
pilson66 earned 250 total points
ID: 36502128
delete from TableA where status != 'A-Active' and status != 'AC-Active';
0
 
LVL 8

Expert Comment

by:pilson66
ID: 36502133
0
 
LVL 8

Expert Comment

by:pilson66
ID: 36502142
delete from TableA where status not in ('A-Active', 'AC-Active');
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 4

Expert Comment

by:veera
ID: 36502154
DELETE FROM TableA WHERE Status != 'A-Active' OR Status != 'AC-Active'
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 36502163
delete from TableA where status not in ('A', 'AC');
0
 
LVL 27

Assisted Solution

by:yodercm
yodercm earned 250 total points
ID: 36502185
BE CAREFUL:

delete from TableA where status != 'A-Active' and status != 'AC-Active';    is CORRECT



DELETE FROM TableA WHERE Status != 'A-Active' OR Status != 'AC-Active'   WILL DELETE EVERYTHING
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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 …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

839 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