mysql multiple limit in one sql statement

mysql, php

Solution

"select N rows for a group in MySQL" : http://explainextended.com/2009/03/06/advanced-row-sampling/

Problem

I have table in my DB called "students" contains the following columns (student_id, student_name, year_of_birth).and array of years I trying to make one query that gets 10 student_id of each year in (years) array. I could write ``` SELECT student_id FROM `students` WHERE year_of_birth=1950 LIMIT 10; SELECT student_id FROM `students` WHERE year_of_birth=1951 LIMIT 10; SELECT student_id FROM `students` WHERE year_of_birth=1952 LIMIT 10; SELECT student_id FROM `students` WHERE year_of_birth=1953 LIMIT 10; (and so on) ``` But that would be very time consuming Are there any other options Thank you

Original source