select SEAT,L_SEAT,rowid,L_rowid from (
select *,
LAG(SEAT) OVER(ORDER BY SEAT*1) L_SEAT,
LAG(STATUS) OVER(ORDER BY SEAT*1) L_STATUS,
LAG(rowid) over(order BY seat*1) L_rowid
from ks3) a
WHERE status='未预订' AND L_STATUS='未预订' and rowid=L_rowid