將Magento從1.7升級到1.8(帶有一些第三個擴展程序)後,我無法再保存產品。每當我保存的產品,我得到這個錯誤:這個Magento查詢有什麼問題?
SQL錯誤:SQLSTATE [21S01]:插入值列表不匹配列列表:1136列數並不在行1
匹配值計數通過調試技術,我能找到的錯誤查詢:
SQL查詢:
INSERT INTO `catalogrule_product_price`
SELECT NULL AS `rule_product_price_id`,
`dates`.`rule_date`,
`t`.`customer_group_id`,
`t`.`product_id`,
MIN(rule_price) AS `rule_price`,
1 AS `website_id`,
`t`.`latest_start_date`,
`t`.`earliest_end_date`
FROM
(SELECT `cppt`.`customer_group_id`,
`cppt`.`product_id`,
CASE WHEN IFNULL((@group_id), 'N/A') != cppt.grouped_id THEN @price := CASE `cppt`.`action_operator` WHEN 'to_percent' THEN cppt.price * cppt.action_amount/100 WHEN 'by_percent' THEN cppt.price * (1 - cppt.action_amount/100) WHEN 'to_fixed' THEN IF((cppt.action_amount < cppt.price), cppt.action_amount, cppt.price) WHEN 'by_fixed' THEN IF((0 > cppt.price - cppt.action_amount), 0, cppt.price - cppt.action_amount) END WHEN IFNULL((@group_id), 'N/A') = cppt.grouped_id AND IFNULL((@action_stop), 0) = 0 THEN @price := CASE `cppt`.`action_operator` WHEN 'to_percent' THEN @price * cppt.action_amount/100 WHEN 'by_percent' THEN @price * (1 - cppt.action_amount/100) WHEN 'to_fixed' THEN IF((cppt.action_amount < @price), cppt.action_amount, @price) WHEN 'by_fixed' THEN IF((0 > @price - cppt.action_amount), 0, @price - cppt.action_amount) END ELSE @price := @price END AS `rule_price`, `cppt`.`from_date` AS `latest_start_date`, `cppt`.`to_date` AS `earliest_end_date`, CASE WHEN IFNULL((@group_id), 'N/A') != cppt.grouped_id THEN @action_stop := cppt.action_stop WHEN IFNULL((@group_id), 'N/A') = cppt.grouped_id THEN @action_stop := IFNULL((@action_stop), 0) + cppt.action_stop END, @group_id := cppt.grouped_id,
`cppt`.`from_time`,
`cppt`.`to_time`
FROM
`catalogrule_product_price_tmp` AS `cppt`
ORDER BY `cppt`.`grouped_id` ASC,
`cppt`.`sort_order` ASC,
`cppt`.`rule_product_id` ASC) AS `t` INNER JOIN (SELECT DATE_ADD(FROM_UNIXTIME(1382202000), INTERVAL -1 DAY) AS rule_date UNION SELECT FROM_UNIXTIME(1382202000) AS rule_date UNION SELECT DATE_ADD(FROM_UNIXTIME(1382202000), INTERVAL 1 DAY) AS rule_date) AS `dates` ON 1=1 WHERE (UNIX_TIMESTAMP(dates.rule_date) >= from_time) AND (IF((to_time = 0), 1, UNIX_TIMESTAMP(dates.rule_date) <= to_time))
GROUP BY `customer_group_id`, `product_id`, `dates`.`rule_date`;
你能指出我爲什麼這個查詢具有錯誤?謝謝!
UPDATE:原因是TBT獎勵模塊在catalogrule_product_price表中添加了名爲「rules_hash」的列。
怎麼沒喲你解決它? –