-3

I have a table named contacts

       id   name  value
        1    a      x 
        2    b      c
        3    c      x
        4    d      x
        5    e      x

How I want to delete the rows that contain value of x ?

xChaax
  • 193
  • 5
  • 27
  • Hi, Welcome to Stack overflow. It seems like this might be a homework question. We don't mind helping with homework, but we do need to see a little bit of what you've tried. At the moment, the question is very much "please do this for me". A little bit of effort goes a long way :) – ScottMcGready Sep 03 '15 at 02:45
  • 1
    possible duplicate of [how to delete duplicate rows from a table in mysql](http://stackoverflow.com/questions/3271396/how-to-delete-duplicate-rows-from-a-table-in-mysql) – ScottMcGready Sep 03 '15 at 02:46
  • FYI it took 3 seconds to find a duplicate question by almost the same name... did you even bother to search for it? – ScottMcGready Sep 03 '15 at 02:47
  • Thanks guys for the info and help :) – xChaax Sep 03 '15 at 02:55

1 Answers1

-1

A simple SQL query will do.

DELETE * FROM contacts WHERE value='x'
  • This doesn't deal with duplicate data - just deletes every row with `x` in the value column – ScottMcGready Sep 03 '15 at 02:48
  • @MrShaa It might solve your immediate problem but please be aware that this **does not remove duplicates**. If you're happy with that, I suggest marking Gwiddle's answer as correct and editing your question to be something like "Removing all rows with specific value in MySQL" as it could be confusing for future users/searchers. – ScottMcGready Sep 03 '15 at 03:07
  • Okay, thanks I have done with editing. Thanks for the answer and guide. – xChaax Sep 03 '15 at 03:26