editing SQL in words#ji because postgresql cannot handle division by zero