Copy n rows based on how many unique values in a column