Hi, I think I've managed to do it :
SELECT IF(competitions.competition_type = 'cup', IFNULL(ROUND(SUM(gate_receipts)/2),0), IFNULL(SUM(gate_receipts),0))AS gate_receipts FROM fixtures_results INNER JOIN competitions ON fixtures_results.competitions_id = competitions.competitions_id WHERE home_teams_id = 27 AND worlds_id = 1 AND status = 'approved' Cheers Neil ---------- Forwarded message ---------- From: Tompkins Neil <neil.tompk...@googlemail.com> Date: Tue, Oct 19, 2010 at 2:01 PM Subject: If within If ? To: "[MySQL]" <mysql@lists.mysql.com> Hi, I've the following query : SELECT IFNULL(SUM(gate_receipts),0) AS gate_receipts, competitions.caption FROM fixtures_results INNER JOIN competitions ON fixtures_results.competitions_id = competitions.competitions_id WHERE home_teams_id = 27 AND worlds_id = 1 AND status = 'approved' However, I want to check the value of competitions.competition_type and if it is 'cup' I want to divide the value of gate_receipts by 2. How is the best way to achieve this ? Regards Neil