p_id int(10) primary key auto_increment,
p_name varchar(10),
p_code varchar(10)
)comment '商品表'...',4),
(9,'name9',2),
(10,'name10',2),
(11,'name11',3),
(12,'name12',3);
第二步:查询
需求:按照p_code字段对product表进行分组并取每组的前两条数据...=p_code 'tmp_code' from product order by p_code)
a where a.tmp_num<2 )
建议在开发环境不要使用order by因为这样会出现文件内排序