hi,i have a table:create table percent(id int,gender int,city int)
and i would like to have a query that will - based on input parameteres - return me desired rows.input parameters are:1. number_of_rows_returned2. percent of gender (based on value 1)3. percent of city (based on value 1)some sample data:insert into percentselect 1, 1, 1 union allselect 2, 1, 2 union allselect 3, 2, 1 union allselect 4, 2, 1 union allselect 5, 1, 2 union allselect 6, 2, 2 union allselect 7, 2, 1 union allselect 8, 1, 1 union allselect 9, 1, 2 union allselect 10, 2,1
i want to have returned all rows that fit criteria, based on input parameters:1. number_of_rows_returned = 42. percent of gender = 50% (meaning 50% male, 50% female; male=1, female=2)3. percent of city = 75% (meaning 75% city, 25% village; city=1, village=2)so i want to have returned four rows,where by column gender i have 2 rows with value 1 and 2 rows with value 2and by column city i have 3 rows with value 1 and 1 row with value 2.expected output:id | gender | city------------------6 | 2 | 27 | 2 | 11 | 1 | 18 | 1 | 1or any other combination. it does not really matter. e.g.id | gender | city------------------1 | 1 | 15 | 1 | 23 | 2 | 14 | 2 | 1thank you