1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- 총 페이지 구하기
select CEILING(count([mail_id])/30.0from MailBox
where limit_time > getdate() and [to] = 13400
 
 
-- 요청 페이지 가져오기
DECLARE @page_no int = 1            -- 페이지 번호
DECLARE @page_row_count int = 28    -- 한 페이지 열 개수
 
SELECT SequenceNo, [from], [to], itemType, receiveType, receiveTime, expireTime from Mailbox
WHERE receive_time < getdate()-1 and expireTime > getdate() and [to] = 13400
ORDER BY expireTime DESC 
OFFSET (@page_no - 1* @page_row_count ROW FETCH NEXT @page_row_count ROW ONLY
 
-- OFFSET (@page_no - 1) * @page_row_count  // 페이지의 시작 번호
-- ROW FETCH NEXT @page_row_count ROW ONLY  // 페이지의 끝 번호

 

+ Recent posts