You can do something like this:

SET @diff = 0;
SELECT count(*) AS number_of_holes, tour_player_score.strokes -
tour_scorecard_hole.par AS overpar, IF(overpar<0,
@diff-(overpar*number_of_holes), ELSEVALUE)
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;

And instead of ELSEVALUE you can insert another IF...
There is also a CASE in MySQL... you can also use that one...

What i don't see here is a DEFAULT value... do you have any ?

--
Gabriel PREDA
Senior Web Developer

Reply via email to