Q&A for administrators and users of the CiviCRM Constituent Relationship Management software
SELECT u.Id AS [User Link], x.postCount, u.* FROM ( SELECT u.Id, COUNT(p.Id) AS postCount FROM Users u JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE u.Location LIKE '%lovely professional%' GROUP BY u.Id ) AS x JOIN Users as u ON u.Id = x.Id