You can use conditional aggregation containing SUM()
such as
SELECT SUM(CASE WHEN was_member='True' THEN avg_amount
WHEN was_member='False' THEN - avg_amount END) AS diff_avg_amount,
year
FROM tab
GROUP BY year
ORDER BY year
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…