fix sql total