我可以在数据库中复制一行,如下所示:

INSERT into `product` (productCode, title, description, price, productGroup)
    SELECT productCode, title, description, price, productGroup
    FROM `product`
WHERE productCode = $_GET['id']

但我希望productCode与我从中复制的行不同。我希望是:$productCode
我该怎么做?

最佳答案

您可以随时更改产品代码值

INSERT into `product` (productCode, title, description, price, productGroup)
SELECT 'your product code value' AS productCode, title, description, price, productGroup
FROM `product`
WHERE productCode = ".$_GET['id']

10-02 15:47