특정 record에 연속된 (다음 id, 하지만 연속적이지는 않을 수 있는) record를 가져오는 방법입니다.
이를 구현하기 위해서 CTE(Common table expression)을 이용하였습니다.
ROW_NUMBER()를 이용하여 연속된 번호를 부여한 뒤에 Join하는 형태의 전략으로 접근하였습니다.
'Database > MSSQL' 카테고리의 다른 글
Insert or update at once (0) | 2016.10.12 |
---|---|
How to Determine Whether Two Date Ranges Overlap (0) | 2016.06.23 |
transaction log for database is full (0) | 2015.05.12 |
a connection was successfully established with the server, but then an error occurred during the pre-login handshake (0) | 2015.04.28 |
Unique index setting #2 (with Criteria) (0) | 2015.03.29 |