MySql 存储过程分页。

use address;
drop procedure if exists `proc_s_area_code`;
delimiter // #告诉mysql解释器,该段命令是否已经结束了,mysql是否可以执行了。
create procedure `proc_s_area_code`(in pager int,limitnum int)
begin
    declare truePage int;
    set truePage=pager*limitnum; #过滤多少条
    select * from `s_area_code` limit truePage,limitnum;
end;

call `proc_s_area_code`(10,3);

效果:

猜你喜欢

转载自www.cnblogs.com/EdinburghOne/p/9274137.html