Fixed order sum in database