SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Delete all rows that contain X in column?

    Can somebody tell me what MySQL command to use to delete all rows that contain X in a certain column?

    Thanks in advance.
    John Saunders

  2. #2
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    DELETE FROM
       tablename
    WHERE
       field_that_has_X_in_it
    LIKE '%X%'
    Lats...

  3. #3
    SitePoint Member
    Join Date
    Dec 2004
    Location
    in my mind. well, physically in the Bay Area
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    u know % is a wildcard, right?

    maybe you have used this already, or already know that '%x%'. but...for anyone else reading this in the future remember this will delete everything like '123xa' or 'exactly' or 'x'. so if you want 'x' as 'x' don't use % signs.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •