title: mysql value greater than percent of number of values
body: <p>I want to find name where the age is greater than n percent of all values in some year.
  Here's the table:</p>
  
  <pre><code>mysql&gt; select * from cust;
  +------+------+------+
  | name | age  | year |
  +------+------+------+
  | toni |   21 | 2016 |
  | robi |   22 | 2016 |
  | deni |   23 | 2016 |
  | jeki |   24 | 2016 |
  | yodi |   25 | 2016 |
  | rino |   26 | 2016 |
  | goli |   27 | 2016 |
  | tobi |   28 | 2016 |
  | lemi |   29 | 2016 |
  | lora |   30 | 2016 |
  | riko |   25 | 2017 |
  | soni |   26 | 2017 |
  | bino |   27 | 2017 |
  | kola |   28 | 2017 |
  | zoki |   29 | 2017 |
  | mera |   30 | 2017 |
  | noki |   31 | 2017 |
  | peni |   32 | 2017 |
  | vino |   33 | 2017 |
  | heri |   34 | 2017 |
  +------+------+------+
  </code></pre>
  
  <p>DDL:</p>
  
  <pre><code>create table tbl ( name varchar(10), age int, year  int);
  insert into tbl values
  ('toni', 21, 2016 ),
  ('robi', 22, 2016 ),
  ('deni', 23, 2016 ),
  ('jeki', 24, 2016 ),
  ('yodi', 25, 2016 ),
  ('rino', 26, 2016 ),
  ('goli', 27, 2016 ),
  ('tobi', 28, 2016 ),
  ('lemi', 29, 2016 ),
  ('lora', 30, 2016 ),
  ('riko', 25, 2017 ),
  ('soni', 26, 2017 ),
  ('bino', 27, 2017 ),
  ('kola', 28, 2017 ),
  ('zoki', 29, 2017 ),
  ('mera', 30, 2017 ),
  ('noki', 31, 2017 ),
  ('peni', 32, 2017 ),
  ('vino', 33, 2017 ),
  ('heri', 34, 2017 );
  </code></pre>
  
  <p>I want to find name from year 2017 where the age is greater than 60% of all age in year 2016. I have done something like this</p>
  
  <pre><code>select name from cust where year=2017 and age&gt;
      (SELECT age
      FROM    (
          SELECT cust.*, @counter := @counter +1 AS counter
          FROM (select @counter:=0) AS initvar, cust where year=2016
          ORDER BY age DESC   
      ) AS X
      where counter &lt;= (60/100 * @counter) 
      ORDER BY age DESC);
  </code></pre>
  
  <p>I know it's wrong but you know what I mean is comparing values between main query 
  and subquery but I want that subquery is more than 1 row.
  Is there a solution that was valid but kind a similar with above?</p>
  
  <p>Edit: here's my desired output:</p>
  
  <pre><code>+------+
  | name |
  +------+
  | soni |
  | bino |
  | kola |
  | zoki |
  | mera |
  | noki |
  | peni |
  | vino |
  | heri |
  +------+
  </code></pre>