use sql subquery for refreshing total points