實現根據當前ID讀取上一條和下一條記錄

如下爲MYSQL語句演示:sql SELECT * FROM t_news AS n ORDER BY n.`News_ID`數據庫 當前ID爲4,讀取上一條記錄:code SELECT * FROM t_news AS n WHERE n.`News_ID` < 4 ORDER BY n.`News_ID` DESC LIMIT 0,1; 當前ID爲4,讀取下一條記錄: SELECT * FR
相關文章
相關標籤/搜索