Skip to content

Instantly share code, notes, and snippets.

@dparker1005
Last active July 28, 2020 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dparker1005/d21cba4286fc0f4fbfc6a8ef699823b5 to your computer and use it in GitHub Desktop.
Save dparker1005/d21cba4286fc0f4fbfc6a8ef699823b5 to your computer and use it in GitHub Desktop.
Get the users who were active on a specific date (as written, June 1st 2020)
SELECT distinct mu.user_id, u.user_email FROM wp_pmpro_memberships_users AS mu
LEFT JOIN wp_users AS u
ON mu.user_id = u.id
WHERE mu.startdate < "2020-06-01 23:59:59"
AND ( mu.enddate > "2020-06-01 00:00:00" OR mu.enddate = "0000-00-00 00:00:00" OR mu.enddate is NULL )
ORDER BY mu.user_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment