I have two tables
activity
id | regionId | method |
and region
id | name |
activity stores several different method strings, the one I’m most interested in being ‘logout’
What I need is to find the region that is logged out the most. I currently have this:
SELECT MAX(regionId) FROM activity GROUP BY regionId WHERE method='logout'
I’m guessing I need a count in there somewhere, but this query is over my head. Also, I would like it to return region.name instead of activity.regionId
Thanks
Try this:
If you need the name instead of the region ID, you could do this: