我用select top 1 from xx where id>xx select top 1 from xx where id>xx得到該文章的上下篇但是不知道怎么在頁面里做。
2 回答

慕哥6287543
TA貢獻(xiàn)1831條經(jīng)驗 獲得超10個贊
這條sql語句可以得到兩條相鄰數(shù)據(jù),然后分別顯示這兩條就ok了
select * from Article where
([ID] = (select MAX([ID]) from Article where [ID]<當(dāng)前文章ID號)
or [ID] = (select MIN([ID]) from Article where [ID]>當(dāng)前文章ID號 ))
或者select top 1 * from Article where ID<當(dāng)前文章ID號 order by ID desc;select top 1 * from Article where ID>當(dāng)前文章ID號 order by ID asc;
- 2 回答
- 0 關(guān)注
- 550 瀏覽
添加回答
舉報
0/150
提交
取消