'sort' for ordered tables