mysql存储过程转移ecshop属性规格
2013-03-25 14:16 来源:www.chinab4c.com 作者:ecshop专家
mysql存储过程转移ecshop属性规格,我们可以通过对mysql的处理来达到批量对ecshop的商品属性规格进行处理。
create procedure att()
BEGIN
declare cat_id1 int default 0;
declare id int default 0;
declare done int default 0;
declare curl cursor for select ext_id,cat_id from ecs_goods_ext_fields0;
declare continue handler for not found set done=1;
open curl;
eloop:LOOP
fetch curl into id,cat_id1;
if done=1 THEN
leave eloop;
end if;
if (cat_id1%10 = 0) then
insert into ecs_goods_attr_fields0 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 1) then
insert into ecs_goods_attr_fields1 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 2) then
insert into ecs_goods_attr_fields2 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 3) then
insert into ecs_goods_attr_fields3 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 4) then
insert into ecs_goods_attr_fields4 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 5) then
insert into ecs_goods_attr_fields5 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 6) then
insert into ecs_goods_attr_fields6 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 7) then
insert into ecs_goods_attr_fields7 select * from ecs_goods_ext_fields0 where ext_id=id;
elseif (cat_id1%10 = 8) then
insert into ecs_goods_attr_fields8 select * from ecs_goods_ext_fields0 where ext_id=id;
else
insert into ecs_goods_attr_fields9 select * from ecs_goods_ext_fields0 where ext_id=id;
end if;
end loop eloop;
close curl;
end;
来源:http://www.chinab4c.com
最近更新
常用插件
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...