Here's my current query:
What this query is supposed to do is: select 30 photos from the "photos" table with a condition that there are at most 3 photos from the same user (or value "id" in the "users" table).Code:SELECT p.*, u.username FROM photos AS p INNER JOIN users AS u ON u.id = p.user_id WHERE p.id IN ( SELECT id FROM photos p WHERE user_id = p.user_id LIMIT 3 ) ORDER BY p.id DESC LIMIT 30;
The problem with this query is that I'm using MySQL 5.1.33 which doesn't yet support LIMIT clause in IN, ANY or SOME subqueries, so the above query doesn't work.
Is it possible to modify this query to work in MySQL 5.1.33?









Bookmarks