[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • 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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
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

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.

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