Reputation: 11
After researching and browsing google for help, I finally got the code I need. It works fine. But...! It works fine with SELECT, but how do I convert it to UPDATE statement?
SELECT
post_content,
concat(
substr(post_content, 1, length(post_content) - length(substring_index(post_content,'<!--more-->',-1)) - 1))
FROM `wp_posts`
WHERE post_status='publish' AND post_type='post'
P.S. Btw, it is wordpress database.
Upvotes: 0
Views: 68
Reputation: 2460
I think there are a fair amount of resources on this...
UPDATE `wp_posts` t
SET t.post_content =
concat(substr(t.post_content, 1, length(t.post_content) -
length(substring_index(t.post_content,'<!--more-->',-1)) - 1))
WHERE t.post_status='publish' AND t.post_type='post'
Upvotes: 1