■ ROW_NUMBER 함수를 사용하는 방법을 보여준다.
▶ 예제 코드 (SQL)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
SELECT ROW_NUMBER() OVER (ORDER BY A.DateTimeWritten DESC, A.DateTimeCreated DESC) AS RowNumber ,A.ID AS ID ,A.DateTimeWritten AS DateTimeWritten ,A.DateTimeCreated AS DateTimeCreated ,A.[FileName] AS [FileName] ,A.FileExtension AS FileExtension FROM ( SELECT A.ID AS ID ,A.DateTimeWritten AS DateTimeWritten ,A.DateTimeCreated AS DateTimeCreated ,A.[FileName] AS [FileName] ,A.FileExtension AS FileExtension FROM PhotoBook AS A WITH(NOLOCK) WHERE A.MenuID = 44 AND A.CategoryName = '자연' ) AS A; |