Hi is there a way that I can do the SUM(total_points) based on a different condition to the rest of the SELECT statement, so I want the SUM(total_points) for every row which is
Do the sum as a subselect, making sure that you select an additional column (don't forget to group by that column) and join the result of this subselect to the main query using the common field.
Template:
Select col1,
col2 as t,x.thesum
From table t left join
( select sum(colx) as thesum, col1 from t where ...
Group by col1) x on t.col1=x.col1
Where ....