Transpose tables,  sort columns and rows