需求:将A表中指定查询条件的数据,插入到B表中。
INSERT INTO ap_base_categories ( category_name, category_id, parent_id, `level`, tree, site_code, created_at, is_leaf, platform ) SELECT category_name, category_id, parent_id, `level`, tree, site_code, created_at, is_leaf, platform FROM ap_categories WHERE platform = 1 AND site_code = 'MY';
注意:字段要一一对应。