一、insert INTO ns_goods_category (shop_id,category_name,short_name,level) select shop_id,"其餘","其餘",1 from ns_shop where shop_id >0;
"其餘","其餘",1
表明插入的表中有的字段而查詢的表中沒有該字段insert into 表名 (字段名) select 字段名 from 表名 where 條件 注意:先後兩個表中的字段名一致,能夠使用該方法 二、update ns_goods g,ns_goods_category c set g.category_id=c.category_id,g.category_id_1=c.category_id where g.shop_id=c.shop_id and g.category_id_1 > 0 and g.shop_id >0;含義:表示將A表中的數據根據條件修改成B表中的數據update table1,table2 set table1.字段名=table2.字段名 where table1.(與table2表有關聯的字段)=table2.(與table1有關聯的字段) and 條件