从MariaDB中的SELECT INSERT INTO

时间:2017-12-16 07:12:31

标签: mysql mariadb

我正在从MySQL中的select进行插入,对于MariaDB是不同的?

我的语法如下:

INSERT INTO catalog_product_index_price (entity_type_id,attribute_id,store_id,entity_id,value) VALUES (
SELECT entity_type_id,attribute_id,store_id,entity_id,value FROM (
    SELECT 4 as entity_type_id, 456 as attribute_id, 0 as store_id, catalog_product_link.product_id as entity_id, catalog_product_index_price.min_price as value
    FROM catalog_product_index_price
    JOIN catalog_product_link ON catalog_product_link.linked_product_id = catalog_product_index_price.entity_id
    WHERE catalog_product_link.link_type_id IN (
        SELECT link_type_id
        FROM catalog_product_link_type
        WHERE code LIKE 'custom_%'
    )
    GROUP BY catalog_product_link.product_id
    ORDER BY catalog_product_index_price.min_price
) as from_price_table);

我收到错误:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 2

0 个答案:

没有答案