tags:

views:

71

answers:

1

Hi,

Here's an easy query to find the average height of boys and girls from a table of all children in a class.

SELECT AVG(table1.height) FROM table1 GROUP BY table.sex

Now I say I want to find the value of the bottom 20% of heights from all boys in a class. How can I do this? So if the possible values are 1,2,3,4,5,6,7,8,9,10 the mysql function would return 2.

thanks a lot for the help, I assume this is possible in sql but that I'm too daft to figure it out.

A: 

I found an article on grouping by percentiles in MySQL. Hopefully this will help you:

http://planet.mysql.com/entry/?id=13620

James Skidmore