SELECT id,region FROM ads
RIGHT JOIN (SELECT * FROM ads a2 WHERE a2.region=ads.region LIMIT 4) AS regions
ON regions.id=ads.id
Says "unknown column ads.region". How to access main table column region?
I need to fetch 4 rows for each region