mysql 取所有分类下前N条记录
SELECT * FROM tb_item AS T WHERE 1>(
SELECT COUNT(id)
FROM tb_item WHERE
`item_category_id`=T.`item_category_id` AND id>T.id)
SELECT * FROM tb_item AS T WHERE 1>(
SELECT COUNT(id)
FROM tb_item WHERE
`item_category_id`=T.`item_category_id` AND id>T.id)
导入数据
mysql -utest -p demo < demo.sql
导出数据
/usr/local/mysql/bin/mysqldump -uroot -p demo > demo.sql