Created
July 10, 2020 18:29
-
-
Save jonathanstegall/8ae69dd95f17f8bec5c674560b2bc07f to your computer and use it in GitHub Desktop.
get a list of stories that are between a certain date range, and that are in a certain list of categories
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 ID, post_date, post_title | |
| FROM wp_posts p | |
| INNER JOIN wp_postmeta m ON p.ID = m.post_id | |
| LEFT JOIN wp_term_relationships r ON (p.ID = r.object_id) | |
| LEFT JOIN wp_term_taxonomy tax ON (r.term_taxonomy_id = tax.term_taxonomy_id) | |
| WHERE post_date >= '2019-06-01' AND post_date < '2020-06-01' AND post_status = 'publish' AND tax.term_id IN (72513, 72511, 72514, 3003, 55565, 55831, 55634, 8389) | |
| GROUP BY p.ID | |
| ORDER BY post_date DESC | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment