I have a table that I wish to run statistical anlyses on. If I had these entires
say
********************************
Id *Individual * Pos * Value*
********************************
1 * p1 * 1 * 10 *
2 * p2 * 1 * 15 *
3 * p1 * 2 * 25 *
4 * p2 * 2 * 28 *
********************************
I wanted to find out which indivduals had a certain average value of pos1 and pos2.
I would need to get P1 value at pos1 (10) then get P1 value at pos2 (25) get the average ((25+20)/2)) and check to see if it matches some user defined value.
I'd be looking for some crazy SQL statement that gets the value of P1,pos1 then the value of P1 pos 2 and sees if the average of those matches a WHERE value and returns the Individual if it does.
It might work like this (if it exists!):
SELECT Individual where (((P1, pos1 value)+(P1,pos2 value)) divided by 2) = user defined value
This would be quite straight forward in PHP but I was wondering if mySQL featured anything that might make this possible as part of a query.
Thanks
say
********************************
Id *Individual * Pos * Value*
********************************
1 * p1 * 1 * 10 *
2 * p2 * 1 * 15 *
3 * p1 * 2 * 25 *
4 * p2 * 2 * 28 *
********************************
I wanted to find out which indivduals had a certain average value of pos1 and pos2.
I would need to get P1 value at pos1 (10) then get P1 value at pos2 (25) get the average ((25+20)/2)) and check to see if it matches some user defined value.
I'd be looking for some crazy SQL statement that gets the value of P1,pos1 then the value of P1 pos 2 and sees if the average of those matches a WHERE value and returns the Individual if it does.
It might work like this (if it exists!):
SELECT Individual where (((P1, pos1 value)+(P1,pos2 value)) divided by 2) = user defined value
This would be quite straight forward in PHP but I was wondering if mySQL featured anything that might make this possible as part of a query.
Thanks