Filter by subquery?
-
Hi,
As a Drupal user I was so grateful to find this plugin, and I especially love being able to just drop a shortcode in a page and have my query all ready to go. I’m a bit stuck now, though, because I can’t find an obvious solution to what I need to do in my query.
I have a query that returns my custom post type of “concert.” Each concert post has a “concert_date” date field created through ACF. The query is supposed to return all the concerts that occur within the current concert season. Now, I suppose I could hardcode dates within the filter (i.e., a
WHERE concert_date BETWEEN 'some date' AND 'some other date'
type clause, though I’m not sure what the syntax would be for Query Wrangler), but I don’t want to do that. I’ve written a custom WP Dashboard plugin and widget that allows the user to define the start and end dates of a concert season easily. It uses its own table (say,myTable
) for entries of concert seasons, e.g.id start_date end_date
4 2015-01-25 2015-12-01
What I would like to do in the QW query is to filter by the ACF custom field “concert_date” in my “concert” post type where concert_date is between the start_date and end_date returned by a subquery such as:
SELECT start_date, end_date FROM myTable ORDER BY id DESC LIMIT 1
.Any thoughts on how I could achieve this?
Thanks!!
- The topic ‘Filter by subquery?’ is closed to new replies.