Take the first few rows of data in MySql and use limit to complete

        There is no top keyword in mysql, but limit can be used to complete this function. The following example will introduce its use method in detail.

        order by id desc limit 10 The first 10 items are retrieved according to the reverse order of id.

        order by id desc limit 0,10 Take out the first 10 items according to the reverse order of id. 

        order by id limit 5,10 According to the positive order of id, take 10 items from the 5th item. 

Example SQL:

SELECT cat_id FROM shop_goods_type order by cat_id desc limit 1

 

Article source: http://www.jb51.net/article/40099.htm

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326777104&siteId=291194637