Jump to content

Need help with SQL Syntax


AlexWright

Recommended Posts

Posted

Hi all! We made a mistake with enabling the replacement of text to emoji, so that © this symbol became an emoji. We are trying to undo that for some of the image descriptions through an SQL query, and could use some help with this. We know it would likely be an update statement, but it get's tricky. We only want to replace this text:

<span class="ipsEmoji"></span>

With just the plain copyright symbol, ©. So it would probably be along the lines of:

UPDATE `ips_gallery_images`
SET image_description = '©'
WHERE image_description = "<span class="ipsemoji"></span>

I obviously know this is incorrect. I'm just trying to save some members the hassle of trying to update over 200 images.

Actually, would this work?

UPDATE 
    ips_gallery_images
SET 
    image_description = REPLACE(image_description,'<span class="ipsemoji"></span>','©')
WHERE 
    image_description LIKE '%<span class="ipsemoji"></span>%'

 

Posted

Got it.

UPDATE ips_gallery_images
SET image_description = REPLACE(image_description,'<span class="ipsEmoji">©</span>','©')
WHERE image_description'LIKE '%<span class="ipsEmoji">©</span>%'

Worked like a charm. Thanks @bfarber

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...