Best groupmember, I have this query
SELECT count(*) AS number_of_holes, tour_player_score.strokes - tour_scorecard_hole.par AS overpar FROM `tour_player_score`, tour_scorecard_hole WHERE tour_player_id=175 AND tour_scorecard_hole.id=tour_player_score.scorecard_hole_id GROUP BY overpar It gives me number_of_holes and overpar. Right now I do this with PHP, but would like to move it to sql directly: $diff = 0; While($Row = mysql_fetch_array()) { If($Row['overpar'])<0) $diff = $diff - $Row['overpar']* $Row['number_of_holes']; Elseif($Row['overpar']>=3) diff = $diff - $Row['overpar']* $Row['number_of_holes'] + 2; } Anyway to move this to MySQL and just have one row containing the diff? Best regards, Peter Lauri -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]