Last active
August 9, 2016 05:59
-
-
Save elimn/a998d7b67f6166dab5e17ec071eb35ee to your computer and use it in GitHub Desktop.
MT | TEC | Count number of recurrences in database
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
| /* | |
| Shows how many recurrences each recurring event has. | |
| Includes events from all statuses including in the trash. | |
| */ | |
| SELECT | |
| `post_parent` as event_id, | |
| COUNT(*) As recurrences | |
| FROM | |
| wp_posts | |
| WHERE | |
| `post_parent` <> 0 | |
| AND `post_type` = 'tribe_events' | |
| GROUP BY | |
| `post_parent` | |
| ORDER BY | |
| `recurrences` DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment