I'm trying to upgrade from to, and got this error:

Error in file: "/www/clonsite/app/code/core/Mage/Sales/data/sales_setup/data-upgrade-" - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main.base_tax_refunded' in 'field list', query was: UPDATE `sales_flat_order_item` AS `main`
 INNER JOIN (SELECT SUM(citem.row_total) AS `amount_refunded`, SUM(citem.base_row_total) AS `base_amount_refunded`, SUM(citem.base_tax_amount) AS `base_tax_refunded`, SUM(citem.discount_amount) AS `discount_refunded`, SUM(citem.base_discount_amount) AS `base_discount_refunded`, `oitem`.`item_id` FROM `sales_flat_creditmemo_item` AS `citem`
 LEFT JOIN `sales_flat_creditmemo` AS `c` ON c.entity_id = citem.parent_id
 LEFT JOIN `sales_flat_order` AS `o` ON o.entity_id = c.order_id
 LEFT JOIN `sales_flat_order_item` AS `oitem` ON oitem.order_id = o.entity_id AND oitem.product_id=citem.product_id GROUP BY `oitem`.`item_id`) AS `selected`
SET `main`.`amount_refunded` = `selected`.`amount_refunded`, `main`.`base_amount_refunded` = `selected`.`base_amount_refunded`, `main`.`base_tax_refunded` = `selected`.`base_tax_refunded`, `main`.`discount_refunded` = `selected`.`discount_refunded`, `main`.`base_discount_refunded` = `selected`.`base_discount_refunded`
WHERE (main.item_id = selected.item_id)

I don't understand the meaning. Should I create some table to leave this error behind? Whch one and how?

Thanks for your help,

1 Answer 1


base_tax_refunded column is missing in sales_flat_order_item table. So create base_tax_refunded column in sales_flat_order_item table. Clear cache.

  • Did that and it kept asking for more columns. I decided to remove the problematic database, imported the old working one, re-uploaded 1.9 files, removed all cache in /vars via FTP, and went to the admin: the upgrading scripts worked this time, no errors were shown, and the install is working now. I'll give the answer as good because it answers what happened and suggests a reasonable fix.
    – Peanuts
    Commented Oct 8, 2018 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.