sql totals updated