इसे आजमाएं:
SELECT district, id, COUNT(b.district)
FROM adverts a INNER JOIN adverts b
ON a.district = b.district
WHERE b.id > a.id
GROUP BY district, id
HAVING COUNT(b.district) < 5
ORDER BY district, id DESC
परिभाषा के अनुसार, Joins
तेज़ हैं subqueries
. की तुलना में .