fixed rewards earned sql