ROW_NUMBER()를 이용한 그룹단위 번호부여 및 정렬
DECLARE @TEST TABLE ( NAME VARCHAR(10), GENDER VARCHAR(5), GRADE CHAR(1)) INSERT INTO @TEST VALUES('PITT', 'MAN', 'A')INSERT INTO @TEST VALUES('JOLIE', 'WOMAN', 'A')INSERT INTO @TEST VALUES('KATE', 'WOMAN', 'A')INSERT INTO @TEST VALUES('BECKAM', 'MAN', 'B') SELECT * FROM @TESTNAME GENDER GRADE PITT MAN A JOLIE WOMAN A KATE WOMAN A BECKAM MAN B SELECT *, ROW_NUMBER() OVER (PARTITION BY GENDER ORD..