Sql partition by row number. Row_Number with Teradata GROUPBY.