MySQL 不支持 top n,改用 limit

之前想在mysql數據庫中查詢某個表中的前 10 條記錄,使用 select top 10 from user; 一直提示語法錯誤。


後來才知道 mysql 不支持 top 關鍵字;改用:select * from user limit 10;

還可以通過 select * from user offset, recnum # 其中offset爲從第幾條(offset+1)記錄開始,recnum 爲返回的記錄條數。

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