Skip to content

Instantly share code, notes, and snippets.

@morganestes
Created July 16, 2020 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganestes/25b881ca3d87f768573ee72701ccaf7e to your computer and use it in GitHub Desktop.
Save morganestes/25b881ca3d87f768573ee72701ccaf7e to your computer and use it in GitHub Desktop.
Compare post content in WordPress with MySQL
# Using the "Bind parameters" option gives you two input fields to enter the post IDs.
SET @p1 = (SELECT `post_content` FROM `wp_posts` WHERE `ID`=:post_id1);
SET @p2 = (SELECT `post_content` FROM `wp_posts` WHERE `ID`=:post_id2);
# https://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html
SELECT STRCMP(@p1,@p2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment