Update table sorting to use offsets (much shorter and less risky query string)