有两张表,product_intro表和product表,其中product是通过product_intro复制的,字段结构一样,我想给product_intro表中凡是bigclassname=红帽产品 or bigclassname=联想产品 or bigclassname=麒麟产品 or bigclassname=VMware产品 or bigclassname=EMC产品 的行的belong=代理产品,我试了很多次,都没插入成功!有没有遇到过同类问题的,共同探讨下
调试欢乐多
insert into product_intro(belong) select belong from product where bigclassname=红帽产品 or
bigclassname=联想产品 or bigclassname=麒麟产品 or bigclassname=VMware产品 or bigclassname=EMC产品;
insert into product_intro(belong) select belong from product where bigclassname='红帽产品' or
bigclassname='联想产品' or bigclassname='麒麟产品' or bigclassname='VMware产品' or bigclassname='EMC产品';
主键等等
update product_intro set belong=代理产品 where bigclassname=红帽产品 or
bigclassname=联想产品 or bigclassname=麒麟产品 or bigclassname=VMware产品 or bigclassname=EMC产品;
主键ID not null以外,其他字段都可以为空! 我要做的凡是 bigclassname=上述5种产品的,belong都插入“代理产品”
product_intro表中ID是否是自增字段
表已有记录的话,则可以这样update就可以了,你上面的语法有误,如下:update product_intro set belong='代理产品' where bigclassname='红帽产品' or
bigclassname='联想产品' or bigclassname='麒麟产品' or bigclassname='VMware产品' or bigclassname='EMC产品';