Results 1 to 4 of 4
  1. #1
    Join Date
    May 2009

    Unanswered: Query Select Like and replace/update

    Good afternoon everyone.

    I am trying to come up with a script that will do a select using a LIKE statment and then updating each found record with the same string minute "THE"

    For example I have several thousand records that need to be update that start like "The Locusts" or the a.k.a.s. What I need to do is replace "The Locusts" with "Locusts".

    So far I know I need to do:
    Select * FROM table where item like "The%'

    Anyone have any experience doing this and want to help out?


  2. #2
    Join Date
    May 2009
    o I should also add the query I am trying to write too.
    This is what I have so far, yet it dosen't seem to work:

    update artists
    set artist = replace(artist, 'the', '')
    where id = 21989

  3. #3
    Join Date
    May 2009
    Found it. I made a temp db from a copy of my live and was able to find what worked.

    update tracks
    set artist = (replace(`artist`, 'The ', ''))
    worked just fine, though it was case sensitive which was also causing problems.

  4. #4
    Join Date
    Jun 2007
    Hopefully you don't have any music by The The.

Posting Permissions

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