Custom MySQL to display Count of Events at each location.
-
On a separate site page, I want to show a listing of each location and the number of events that have taken place there. I’m using;
=======
SELECT
wp_em_locations.location_name
as “Location”, COUNT(*) as “Total”
FROM wp_em_locations
INNER JOIN wp_em_events
ON wp_em_locations.location_id
= wp_em_events.location_id
GROUP BY wp_em_events.location_id
Order By “Total”
=======This works fine. However it gives me ALL events and I just want events from a single category. The wp_em_category_id field in the db is showing null values, so I expect the categories I have used are in a meta table table somewhere. How would I do this please?
Thanks Simon
- The topic ‘Custom MySQL to display Count of Events at each location.’ is closed to new replies.