table "Purchase"
table "Catalog" has 'purchase_id' column in table
table "Product" has 'catalog_id' column in its table.
一键复制recrds的方法是什么?一些已经激活的“购买”包含所有目录和产品所包含的产品?
看起来此帖子Duplicate a record in MySQL或多或少已连接。这样做的方法是什么?
答案 0 :(得分:0)
插入选择':
insert into <table> ( purchase_id, catalog_id, product_id )
select purchase_id, catalog_id, product_id from Purchase
join Catalog using ( purchase_id )
join Product using ( catalog_id )
where <some condition>;