Im trying to pull a range of teams with points from 175-249. I have the query right and it works without trying to get the range. Once I add the range, using between, it breaks. Also I get the error that points isnt a known column. I know its not as Ive assigned it an alias since its a sum of multiple rows. Heres my code and any help is appreciated.
$query = mysql_query("SELECT t.team_id,
t.partner1_firstname, t.partner1_lastname,
t.partner2_firstname, t.partner2_lastname,
s.sched_id, s.date_y, r.div_id,
SUM(r.results_numfish) AS numfish,
SUM(r.results_netwgt) AS netwgt,
MAX(r.results_bigfish) AS bigfish,
SUM(r.results_points) AS points
FROM ".$prefix."_tourn_teams t
LEFT JOIN ".$prefix."_tourn_results r ON r.team_id=t.team_id
LEFT JOIN ".$prefix."_tourn_schedules s ON s.sched_id=r.sched_id
WHERE s.date_y=$year AND (points BETWEEN 175 AND 249)
GROUP BY t.team_id
ORDER BY points DESC");