轉自http://www.cnblogs.com/study100/archive/2013/07/30/3224250.html
在mysql中是沒有top關鍵字的,在mysql中可以用limit來完成功能。
order by id desc limit 10 按照id的倒序排序 取出前10條
order by id desc limit 0,10 按照id的倒序排序 取出前10條
order by id limit 5,10 按照id的正序排序 從第5條開始取10條
sql語句:
SELECT cat_id FROM shop_goods_type order by cat_id desc limit 1