Last active
August 29, 2015 14:17
-
-
Save remcotolsma/202cdcedc3f6e2b3c32d to your computer and use it in GitHub Desktop.
Select Easy Digital Downloads license users and post authors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
post.ID, | |
post.post_author, | |
post.post_title, | |
post.post_date, | |
post.post_type, | |
meta.meta_value AS edd_sl_user_id | |
FROM | |
wp_2_posts AS post | |
LEFT JOIN | |
wp_2_postmeta AS meta | |
ON post.ID = meta.post_id AND meta.meta_key = '_edd_sl_user_id' | |
WHERE | |
post.post_type = 'edd_license' | |
AND | |
post.post_date < '2014-12-10 15:00:00' | |
AND | |
post.post_author NOT IN ( 1, 2 ) | |
AND | |
post.post_author != meta.meta_value | |
ORDER BY | |
post_date | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE | |
wp_2_posts AS post | |
LEFT JOIN | |
wp_2_postmeta AS meta | |
ON post.ID = meta.post_id AND meta.meta_key = '_edd_sl_user_id' | |
SET | |
meta.meta_value = post.post_author | |
WHERE | |
post.post_type = 'edd_license' | |
AND | |
post.post_date < '2014-12-10 15:00:00' | |
AND | |
post.post_author NOT IN ( 1, 2 ) | |
AND | |
post.post_author != meta.meta_value | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment