I've been working on this one for a few hours and can't seem to figure out what I'm fudging up here:
$sql = "SELECT AVG(a.score) FROM drillscore as a, players AS b WHERE a.drill_id='2' AND b.age BETWEEN '19' AND '100' AND a.customers_id=b.customers_id";
If I remove everything after - a.drill_id='2' - it works fine. I use a similar query just before it like this:
$sql = "SELECT AVG(a.score) FROM drillscore as a, coached AS b WHERE drill_id='2' AND b.team_id='$q' AND a.customers_id=b.customers_id";
And it works fine. I want to divide the results together to get the average of a group of users compared to all other users in their age group. I've never use BETWEEN x AND y in a query before so I figure it's that but I haven't been able to figure out what's going wrong. Thanks in advance for any advice.