SELECT student_id FROM `students` AS s1
WHERE student_id IN
(SELECT s2.student_id FROM `students` AS s2
WHERE s1.year_of_birth = s2.year_of_birth
LIMIT 10)
Can't process this query on my server. It drops errors, that says that this version of mysql doesn't support limit inside subqueries etc(ERROR 1235).
Is there any solution for my version of mysql 5.1.49?
SELECT
id,
region
FROM (
SELECT
region,
id,
@rn := CASE WHEN @prev_region = region
THEN @rn + 1
ELSE 1
END AS rn,
@prev_region := region
FROM (SELECT @prev_region := NULL) vars, ads T1
ORDER BY region, id DESC
) T2
WHERE rn <= 4
ORDER BY region, id
Thanks to Mark Byers