Wednesday, February 13, 2013

[MYSQL] 設定要撈出幾筆資料"LIMIT"

本範例為從0的位置(即第一筆)開始,取出五筆資料。

 SELECT * FROM mytable ORDER BY id DESC LIMIT 0,5

 也可簡寫成

 SELECT * FROM mytable ORDER BY id DESC LIMIT 5

No comments:

Post a Comment