Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

MySQL Delete records

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
pda4me
Asked:
pda4me
2 Solutions
 
pilson66Commented:
delete from TableA where status != 'A-Active' and status != 'AC-Active';
0
 
pilson66Commented:
0
 
pilson66Commented:
delete from TableA where status not in ('A-Active', 'AC-Active');
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
veeraCommented:
DELETE FROM TableA WHERE Status != 'A-Active' OR Status != 'AC-Active'
0
 
Pratima PharandeCommented:
delete from TableA where status not in ('A', 'AC');
0
 
Cornelia YoderArtistCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now