Created
July 6, 2016 21:38
-
-
Save barryhughes/846443217379309153d3006a8a509ca2 to your computer and use it in GitHub Desktop.
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
| -- Get the missing order post IDs | |
| SELECT post_id as missing_order, | |
| -- "Estimate" the date by looking at the next available post's date | |
| ( | |
| SELECT post_date | |
| FROM wp_posts | |
| WHERE ID > post_id | |
| ORDER BY ID ASC | |
| LIMIT 1 | |
| ) as nearest_date | |
| FROM wp_postmeta | |
| LEFT JOIN wp_posts | |
| ON wp_posts.ID = wp_postmeta.post_id | |
| -- Order posts all have a _payment_method meta field | |
| -- (indicating PayPal or Stripe, etc) | |
| WHERE meta_key = '_payment_method' | |
| AND ID IS NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment