Solved

MySQL Delete records

Posted on 2011-09-08
6
241 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
Comment Utility
delete from TableA where status != 'A-Active' and status != 'AC-Active';
0
 
LVL 8

Expert Comment

by:pilson66
Comment Utility
0
 
LVL 8

Expert Comment

by:pilson66
Comment Utility
delete from TableA where status not in ('A-Active', 'AC-Active');
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Expert Comment

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

Expert Comment

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

Assisted Solution

by:yodercm
yodercm earned 250 total points
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Creating and Managing Databases with phpMyAdmin in cPanel.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

9 Experts available now in Live!

Get 1:1 Help Now