簡單的問題,查詢數據庫中第 N 條記錄

我有一個數據庫, ProjID (int 主鍵), Project (varchar), Notify (int)
現在我要根據 Notify 的值來查詢某一條記錄,比如 Notify = 10 ,我就是要查詢

數據庫中第10條記錄,

這個用 select 語句怎麼來查詢 ?

 

DECLARE @CurrID int
SELECT @CurrID = notify FROM
Project_Projects
exec('select top 1 * from (select top '+@CurrID+' * from tb) a order by projid desc')

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章