PDOException Object
(
    [message:protected] => SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 1
    [string:private] => 
    [code:protected] => 23000
    [file:protected] => /home/bestrcom/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php
    [line:protected] => 276
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] => /home/bestrcom/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php
                    [line] => 276
                    [function] => query
                    [class] => PDO
                    [type] => ->
                    [args] => Array
                        (
                            [0] => INSERT INTO `sales_flat_order` (`entity_id`,`increment_id`,`store_id`,`created_at`,`updated_at`,`customer_id`,`tax_amount`,`shipping_amount`,`discount_amount`,`subtotal`,`grand_total`,`total_paid`,`total_refunded`,`total_qty_ordered`,`total_canceled`,`total_invoiced`,`total_online_refunded`,`total_offline_refunded`,`base_tax_amount`,`base_shipping_amount`,`base_discount_amount`,`base_subtotal`,`base_grand_total`,`base_total_paid`,`base_total_refunded`,`base_total_qty_ordered`,`base_total_canceled`,`base_total_invoiced`,`base_total_online_refunded`,`base_total_offline_refunded`,`subtotal_refunded`,`subtotal_canceled`,`discount_refunded`,`discount_canceled`,`discount_invoiced`,`tax_refunded`,`tax_canceled`,`shipping_refunded`,`shipping_canceled`,`base_subtotal_refunded`,`base_subtotal_canceled`,`base_discount_refunded`,`base_discount_canceled`,`base_discount_invoiced`,`base_tax_refunded`,`base_tax_canceled`,`base_shipping_refunded`,`base_shipping_canceled`,`subtotal_invoiced`,`tax_invoiced`,`shipping_invoiced`,`base_subtotal_invoiced`,`base_tax_invoiced`,`base_shipping_invoiced`,`shipping_tax_amount`,`base_shipping_tax_amount`,`shipping_tax_refunded`,`base_shipping_tax_refunded`,`base_total_invoiced_cost`,`protect_code`,`store_to_base_rate`,`store_to_order_rate`,`base_to_global_rate`,`base_to_order_rate`,`status`,`state`,`is_virtual`,`shipping_description`,`coupon_code`) SELECT `e`.`entity_id`, `e`.`increment_id`, `e`.`store_id`, `e`.`created_at`, `e`.`updated_at`, `e`.`customer_id`, `e`.`tax_amount`, `e`.`shipping_amount`, `e`.`discount_amount`, `e`.`subtotal`, `e`.`grand_total`, `e`.`total_paid`, `e`.`total_refunded`, `e`.`total_qty_ordered`, `e`.`total_canceled`, `e`.`total_invoiced`, `e`.`total_online_refunded`, `e`.`total_offline_refunded`, `e`.`base_tax_amount`, `e`.`base_shipping_amount`, `e`.`base_discount_amount`, `e`.`base_subtotal`, `e`.`base_grand_total`, `e`.`base_total_paid`, `e`.`base_total_refunded`, `e`.`base_total_qty_ordered`, `e`.`base_total_canceled`, `e`.`base_total_invoiced`, `e`.`base_total_online_refunded`, `e`.`base_total_offline_refunded`, `e`.`subtotal_refunded`, `e`.`subtotal_canceled`, `e`.`discount_refunded`, `e`.`discount_canceled`, `e`.`discount_invoiced`, `e`.`tax_refunded`, `e`.`tax_canceled`, `e`.`shipping_refunded`, `e`.`shipping_canceled`, `e`.`base_subtotal_refunded`, `e`.`base_subtotal_canceled`, `e`.`base_discount_refunded`, `e`.`base_discount_canceled`, `e`.`base_discount_invoiced`, `e`.`base_tax_refunded`, `e`.`base_tax_canceled`, `e`.`base_shipping_refunded`, `e`.`base_shipping_canceled`, `e`.`subtotal_invoiced`, `e`.`tax_invoiced`, `e`.`shipping_invoiced`, `e`.`base_subtotal_invoiced`, `e`.`base_tax_invoiced`, `e`.`base_shipping_invoiced`, `e`.`shipping_tax_amount`, `e`.`base_shipping_tax_amount`, `e`.`shipping_tax_refunded`, `e`.`base_shipping_tax_refunded`, `e`.`base_total_invoiced_cost`, `e`.`protect_code`, `e`.`store_to_base_rate`, `e`.`store_to_order_rate`, `e`.`base_to_global_rate`, `e`.`base_to_order_rate`, `e`.`status`, `e`.`state`, `e`.`is_virtual`, `e`.`shipping_description`, `e`.`coupon_code` FROM `sales_order` AS `e` WHERE (e.entity_type_id = '11')
                        )
                )
            [1] => Array
                (
                    [file] => /home/bestrcom/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php
                    [line] => 397
                    [function] => raw_query
                    [class] => Varien_Db_Adapter_Pdo_Mysql
                    [type] => ->
                    [args] => Array
                        (
                            [0] => INSERT INTO `sales_flat_order` (`entity_id`,`increment_id`,`store_id`,`created_at`,`updated_at`,`customer_id`,`tax_amount`,`shipping_amount`,`discount_amount`,`subtotal`,`grand_total`,`total_paid`,`total_refunded`,`total_qty_ordered`,`total_canceled`,`total_invoiced`,`total_online_refunded`,`total_offline_refunded`,`base_tax_amount`,`base_shipping_amount`,`base_discount_amount`,`base_subtotal`,`base_grand_total`,`base_total_paid`,`base_total_refunded`,`base_total_qty_ordered`,`base_total_canceled`,`base_total_invoiced`,`base_total_online_refunded`,`base_total_offline_refunded`,`subtotal_refunded`,`subtotal_canceled`,`discount_refunded`,`discount_canceled`,`discount_invoiced`,`tax_refunded`,`tax_canceled`,`shipping_refunded`,`shipping_canceled`,`base_subtotal_refunded`,`base_subtotal_canceled`,`base_discount_refunded`,`base_discount_canceled`,`base_discount_invoiced`,`base_tax_refunded`,`base_tax_canceled`,`base_shipping_refunded`,`base_shipping_canceled`,`subtotal_invoiced`,`tax_invoiced`,`shipping_invoiced`,`base_subtotal_invoiced`,`base_tax_invoiced`,`base_shipping_invoiced`,`shipping_tax_amount`,`base_shipping_tax_amount`,`shipping_tax_refunded`,`base_shipping_tax_refunded`,`base_total_invoiced_cost`,`protect_code`,`store_to_base_rate`,`store_to_order_rate`,`base_to_global_rate`,`base_to_order_rate`,`status`,`state`,`is_virtual`,`shipping_description`,`coupon_code`) SELECT `e`.`entity_id`, `e`.`increment_id`, `e`.`store_id`, `e`.`created_at`, `e`.`updated_at`, `e`.`customer_id`, `e`.`tax_amount`, `e`.`shipping_amount`, `e`.`discount_amount`, `e`.`subtotal`, `e`.`grand_total`, `e`.`total_paid`, `e`.`total_refunded`, `e`.`total_qty_ordered`, `e`.`total_canceled`, `e`.`total_invoiced`, `e`.`total_online_refunded`, `e`.`total_offline_refunded`, `e`.`base_tax_amount`, `e`.`base_shipping_amount`, `e`.`base_discount_amount`, `e`.`base_subtotal`, `e`.`base_grand_total`, `e`.`base_total_paid`, `e`.`base_total_refunded`, `e`.`base_total_qty_ordered`, `e`.`base_total_canceled`, `e`.`base_total_invoiced`, `e`.`base_total_online_refunded`, `e`.`base_total_offline_refunded`, `e`.`subtotal_refunded`, `e`.`subtotal_canceled`, `e`.`discount_refunded`, `e`.`discount_canceled`, `e`.`discount_invoiced`, `e`.`tax_refunded`, `e`.`tax_canceled`, `e`.`shipping_refunded`, `e`.`shipping_canceled`, `e`.`base_subtotal_refunded`, `e`.`base_subtotal_canceled`, `e`.`base_discount_refunded`, `e`.`base_discount_canceled`, `e`.`base_discount_invoiced`, `e`.`base_tax_refunded`, `e`.`base_tax_canceled`, `e`.`base_shipping_refunded`, `e`.`base_shipping_canceled`, `e`.`subtotal_invoiced`, `e`.`tax_invoiced`, `e`.`shipping_invoiced`, `e`.`base_subtotal_invoiced`, `e`.`base_tax_invoiced`, `e`.`base_shipping_invoiced`, `e`.`shipping_tax_amount`, `e`.`base_shipping_tax_amount`, `e`.`shipping_tax_refunded`, `e`.`base_shipping_tax_refunded`, `e`.`base_total_invoiced_cost`, `e`.`protect_code`, `e`.`store_to_base_rate`, `e`.`store_to_order_rate`, `e`.`base_to_global_rate`, `e`.`base_to_order_rate`, `e`.`status`, `e`.`state`, `e`.`is_virtual`, `e`.`shipping_description`, `e`.`coupon_code` FROM `sales_order` AS `e` WHERE (e.entity_type_id = '11')
                        )
                )
            [2] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 636
                    [function] => multi_query
                    [class] => Varien_Db_Adapter_Pdo_Mysql
                    [type] => ->
                    [args] => Array
                        (
                            [0] => INSERT INTO `sales_flat_order` (`entity_id`,`increment_id`,`store_id`,`created_at`,`updated_at`,`customer_id`,`tax_amount`,`shipping_amount`,`discount_amount`,`subtotal`,`grand_total`,`total_paid`,`total_refunded`,`total_qty_ordered`,`total_canceled`,`total_invoiced`,`total_online_refunded`,`total_offline_refunded`,`base_tax_amount`,`base_shipping_amount`,`base_discount_amount`,`base_subtotal`,`base_grand_total`,`base_total_paid`,`base_total_refunded`,`base_total_qty_ordered`,`base_total_canceled`,`base_total_invoiced`,`base_total_online_refunded`,`base_total_offline_refunded`,`subtotal_refunded`,`subtotal_canceled`,`discount_refunded`,`discount_canceled`,`discount_invoiced`,`tax_refunded`,`tax_canceled`,`shipping_refunded`,`shipping_canceled`,`base_subtotal_refunded`,`base_subtotal_canceled`,`base_discount_refunded`,`base_discount_canceled`,`base_discount_invoiced`,`base_tax_refunded`,`base_tax_canceled`,`base_shipping_refunded`,`base_shipping_canceled`,`subtotal_invoiced`,`tax_invoiced`,`shipping_invoiced`,`base_subtotal_invoiced`,`base_tax_invoiced`,`base_shipping_invoiced`,`shipping_tax_amount`,`base_shipping_tax_amount`,`shipping_tax_refunded`,`base_shipping_tax_refunded`,`base_total_invoiced_cost`,`protect_code`,`store_to_base_rate`,`store_to_order_rate`,`base_to_global_rate`,`base_to_order_rate`,`status`,`state`,`is_virtual`,`shipping_description`,`coupon_code`) SELECT `e`.`entity_id`, `e`.`increment_id`, `e`.`store_id`, `e`.`created_at`, `e`.`updated_at`, `e`.`customer_id`, `e`.`tax_amount`, `e`.`shipping_amount`, `e`.`discount_amount`, `e`.`subtotal`, `e`.`grand_total`, `e`.`total_paid`, `e`.`total_refunded`, `e`.`total_qty_ordered`, `e`.`total_canceled`, `e`.`total_invoiced`, `e`.`total_online_refunded`, `e`.`total_offline_refunded`, `e`.`base_tax_amount`, `e`.`base_shipping_amount`, `e`.`base_discount_amount`, `e`.`base_subtotal`, `e`.`base_grand_total`, `e`.`base_total_paid`, `e`.`base_total_refunded`, `e`.`base_total_qty_ordered`, `e`.`base_total_canceled`, `e`.`base_total_invoiced`, `e`.`base_total_online_refunded`, `e`.`base_total_offline_refunded`, `e`.`subtotal_refunded`, `e`.`subtotal_canceled`, `e`.`discount_refunded`, `e`.`discount_canceled`, `e`.`discount_invoiced`, `e`.`tax_refunded`, `e`.`tax_canceled`, `e`.`shipping_refunded`, `e`.`shipping_canceled`, `e`.`base_subtotal_refunded`, `e`.`base_subtotal_canceled`, `e`.`base_discount_refunded`, `e`.`base_discount_canceled`, `e`.`base_discount_invoiced`, `e`.`base_tax_refunded`, `e`.`base_tax_canceled`, `e`.`base_shipping_refunded`, `e`.`base_shipping_canceled`, `e`.`subtotal_invoiced`, `e`.`tax_invoiced`, `e`.`shipping_invoiced`, `e`.`base_subtotal_invoiced`, `e`.`base_tax_invoiced`, `e`.`base_shipping_invoiced`, `e`.`shipping_tax_amount`, `e`.`base_shipping_tax_amount`, `e`.`shipping_tax_refunded`, `e`.`base_shipping_tax_refunded`, `e`.`base_total_invoiced_cost`, `e`.`protect_code`, `e`.`store_to_base_rate`, `e`.`store_to_order_rate`, `e`.`base_to_global_rate`, `e`.`base_to_order_rate`, `e`.`status`, `e`.`state`, `e`.`is_virtual`, `e`.`shipping_description`, `e`.`coupon_code` FROM `sales_order` AS `e` WHERE (e.entity_type_id = '11'); 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_decimal` AS `_table_adjustment_negative` ON _table_adjustment_negative.entity_id = e.entity_id AND _table_adjustment_negative.attribute_id = 150
 LEFT JOIN `sales_order_decimal` AS `_table_adjustment_positive` ON _table_adjustment_positive.entity_id = e.entity_id AND _table_adjustment_positive.attribute_id = 149
 LEFT JOIN `sales_order_decimal` AS `_table_base_adjustment_negative` ON _table_base_adjustment_negative.entity_id = e.entity_id AND _table_base_adjustment_negative.attribute_id = 168
 LEFT JOIN `sales_order_decimal` AS `_table_base_adjustment_positive` ON _table_base_adjustment_positive.entity_id = e.entity_id AND _table_base_adjustment_positive.attribute_id = 167
 LEFT JOIN `sales_order_decimal` AS `_table_base_custbalance_amount` ON _table_base_custbalance_amount.entity_id = e.entity_id AND _table_base_custbalance_amount.attribute_id = 156
 LEFT JOIN `sales_order_decimal` AS `_table_base_shipping_discount_amount` ON _table_base_shipping_discount_amount.entity_id = e.entity_id AND _table_base_shipping_discount_amount.attribute_id = 516
 LEFT JOIN `sales_order_decimal` AS `_table_base_subtotal_incl_tax` ON _table_base_subtotal_incl_tax.entity_id = e.entity_id AND _table_base_subtotal_incl_tax.attribute_id = 523
 LEFT JOIN `sales_order_decimal` AS `_table_base_total_due` ON _table_base_total_due.entity_id = e.entity_id AND _table_base_total_due.attribute_id = 160
 LEFT JOIN `sales_order_decimal` AS `_table_custbalance_amount` ON _table_custbalance_amount.entity_id = e.entity_id AND _table_custbalance_amount.attribute_id = 138
 LEFT JOIN `sales_order_decimal` AS `_table_payment_authorization_amount` ON _table_payment_authorization_amount.entity_id = e.entity_id AND _table_payment_authorization_amount.attribute_id = 458
 LEFT JOIN `sales_order_decimal` AS `_table_shipping_discount_amount` ON _table_shipping_discount_amount.entity_id = e.entity_id AND _table_shipping_discount_amount.attribute_id = 515
 LEFT JOIN `sales_order_decimal` AS `_table_subtotal_incl_tax` ON _table_subtotal_incl_tax.entity_id = e.entity_id AND _table_subtotal_incl_tax.attribute_id = 522
 LEFT JOIN `sales_order_decimal` AS `_table_total_due` ON _table_total_due.entity_id = e.entity_id AND _table_total_due.attribute_id = 142
 LEFT JOIN `sales_order_decimal` AS `_table_weight` ON _table_weight.entity_id = e.entity_id AND _table_weight.attribute_id = 132
 SET `e`.`adjustment_negative` = `_table_adjustment_negative`.`value`, `e`.`adjustment_positive` = `_table_adjustment_positive`.`value`, `e`.`base_adjustment_negative` = `_table_base_adjustment_negative`.`value`, `e`.`base_adjustment_positive` = `_table_base_adjustment_positive`.`value`, `e`.`base_custbalance_amount` = `_table_base_custbalance_amount`.`value`, `e`.`base_shipping_discount_amount` = `_table_base_shipping_discount_amount`.`value`, `e`.`base_subtotal_incl_tax` = `_table_base_subtotal_incl_tax`.`value`, `e`.`base_total_due` = `_table_base_total_due`.`value`, `e`.`custbalance_amount` = `_table_custbalance_amount`.`value`, `e`.`payment_authorization_amount` = `_table_payment_authorization_amount`.`value`, `e`.`shipping_discount_amount` = `_table_shipping_discount_amount`.`value`, `e`.`subtotal_incl_tax` = `_table_subtotal_incl_tax`.`value`, `e`.`total_due` = `_table_total_due`.`value`, `e`.`weight` = `_table_weight`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_varchar` AS `_table_applied_rule_ids` ON _table_applied_rule_ids.entity_id = e.entity_id AND _table_applied_rule_ids.attribute_id = 118
 LEFT JOIN `sales_order_varchar` AS `_table_base_currency_code` ON _table_base_currency_code.entity_id = e.entity_id AND _table_base_currency_code.attribute_id = 121
 LEFT JOIN `sales_order_varchar` AS `_table_customer_email` ON _table_customer_email.entity_id = e.entity_id AND _table_customer_email.attribute_id = 195
 LEFT JOIN `sales_order_varchar` AS `_table_customer_firstname` ON _table_customer_firstname.entity_id = e.entity_id AND _table_customer_firstname.attribute_id = 197
 LEFT JOIN `sales_order_varchar` AS `_table_customer_lastname` ON _table_customer_lastname.entity_id = e.entity_id AND _table_customer_lastname.attribute_id = 199
 LEFT JOIN `sales_order_varchar` AS `_table_customer_middlename` ON _table_customer_middlename.entity_id = e.entity_id AND _table_customer_middlename.attribute_id = 198
 LEFT JOIN `sales_order_varchar` AS `_table_customer_prefix` ON _table_customer_prefix.entity_id = e.entity_id AND _table_customer_prefix.attribute_id = 196
 LEFT JOIN `sales_order_varchar` AS `_table_customer_suffix` ON _table_customer_suffix.entity_id = e.entity_id AND _table_customer_suffix.attribute_id = 200
 LEFT JOIN `sales_order_varchar` AS `_table_customer_taxvat` ON _table_customer_taxvat.entity_id = e.entity_id AND _table_customer_taxvat.attribute_id = 205
 LEFT JOIN `sales_order_varchar` AS `_table_discount_description` ON _table_discount_description.entity_id = e.entity_id AND _table_discount_description.attribute_id = 514
 LEFT JOIN `sales_order_varchar` AS `_table_ext_customer_id` ON _table_ext_customer_id.entity_id = e.entity_id AND _table_ext_customer_id.attribute_id = 112
 LEFT JOIN `sales_order_varchar` AS `_table_ext_order_id` ON _table_ext_order_id.entity_id = e.entity_id AND _table_ext_order_id.attribute_id = 111
 LEFT JOIN `sales_order_varchar` AS `_table_global_currency_code` ON _table_global_currency_code.entity_id = e.entity_id AND _table_global_currency_code.attribute_id = 120
 LEFT JOIN `sales_order_varchar` AS `_table_hold_before_state` ON _table_hold_before_state.entity_id = e.entity_id AND _table_hold_before_state.attribute_id = 104
 LEFT JOIN `sales_order_varchar` AS `_table_hold_before_status` ON _table_hold_before_status.entity_id = e.entity_id AND _table_hold_before_status.attribute_id = 103
 LEFT JOIN `sales_order_varchar` AS `_table_order_currency_code` ON _table_order_currency_code.entity_id = e.entity_id AND _table_order_currency_code.attribute_id = 123
 LEFT JOIN `sales_order_varchar` AS `_table_original_increment_id` ON _table_original_increment_id.entity_id = e.entity_id AND _table_original_increment_id.attribute_id = 109
 LEFT JOIN `sales_order_varchar` AS `_table_relation_child_id` ON _table_relation_child_id.entity_id = e.entity_id AND _table_relation_child_id.attribute_id = 107
 LEFT JOIN `sales_order_varchar` AS `_table_relation_child_real_id` ON _table_relation_child_real_id.entity_id = e.entity_id AND _table_relation_child_real_id.attribute_id = 108
 LEFT JOIN `sales_order_varchar` AS `_table_relation_parent_id` ON _table_relation_parent_id.entity_id = e.entity_id AND _table_relation_parent_id.attribute_id = 105
 LEFT JOIN `sales_order_varchar` AS `_table_relation_parent_real_id` ON _table_relation_parent_real_id.entity_id = e.entity_id AND _table_relation_parent_real_id.attribute_id = 106
 LEFT JOIN `sales_order_varchar` AS `_table_remote_ip` ON _table_remote_ip.entity_id = e.entity_id AND _table_remote_ip.attribute_id = 100
 LEFT JOIN `sales_order_varchar` AS `_table_shipping_method` ON _table_shipping_method.entity_id = e.entity_id AND _table_shipping_method.attribute_id = 130
 LEFT JOIN `sales_order_varchar` AS `_table_store_currency_code` ON _table_store_currency_code.entity_id = e.entity_id AND _table_store_currency_code.attribute_id = 122
 LEFT JOIN `sales_order_varchar` AS `_table_store_name` ON _table_store_name.entity_id = e.entity_id AND _table_store_name.attribute_id = 99
 LEFT JOIN `sales_order_varchar` AS `_table_x_forwarded_for` ON _table_x_forwarded_for.entity_id = e.entity_id AND _table_x_forwarded_for.attribute_id = 508
 SET `e`.`applied_rule_ids` = `_table_applied_rule_ids`.`value`, `e`.`base_currency_code` = `_table_base_currency_code`.`value`, `e`.`customer_email` = `_table_customer_email`.`value`, `e`.`customer_firstname` = `_table_customer_firstname`.`value`, `e`.`customer_lastname` = `_table_customer_lastname`.`value`, `e`.`customer_middlename` = `_table_customer_middlename`.`value`, `e`.`customer_prefix` = `_table_customer_prefix`.`value`, `e`.`customer_suffix` = `_table_customer_suffix`.`value`, `e`.`customer_taxvat` = `_table_customer_taxvat`.`value`, `e`.`discount_description` = `_table_discount_description`.`value`, `e`.`ext_customer_id` = `_table_ext_customer_id`.`value`, `e`.`ext_order_id` = `_table_ext_order_id`.`value`, `e`.`global_currency_code` = `_table_global_currency_code`.`value`, `e`.`hold_before_state` = `_table_hold_before_state`.`value`, `e`.`hold_before_status` = `_table_hold_before_status`.`value`, `e`.`order_currency_code` = `_table_order_currency_code`.`value`, `e`.`original_increment_id` = `_table_original_increment_id`.`value`, `e`.`relation_child_id` = `_table_relation_child_id`.`value`, `e`.`relation_child_real_id` = `_table_relation_child_real_id`.`value`, `e`.`relation_parent_id` = `_table_relation_parent_id`.`value`, `e`.`relation_parent_real_id` = `_table_relation_parent_real_id`.`value`, `e`.`remote_ip` = `_table_remote_ip`.`value`, `e`.`shipping_method` = `_table_shipping_method`.`value`, `e`.`store_currency_code` = `_table_store_currency_code`.`value`, `e`.`store_name` = `_table_store_name`.`value`, `e`.`x_forwarded_for` = `_table_x_forwarded_for`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_int` AS `_table_billing_address_id` ON _table_billing_address_id.entity_id = e.entity_id AND _table_billing_address_id.attribute_id = 115
 LEFT JOIN `sales_order_int` AS `_table_can_ship_partially` ON _table_can_ship_partially.entity_id = e.entity_id AND _table_can_ship_partially.attribute_id = 456
 LEFT JOIN `sales_order_int` AS `_table_can_ship_partially_item` ON _table_can_ship_partially_item.entity_id = e.entity_id AND _table_can_ship_partially_item.attribute_id = 457
 LEFT JOIN `sales_order_int` AS `_table_customer_gender` ON _table_customer_gender.entity_id = e.entity_id AND _table_customer_gender.attribute_id = 511
 LEFT JOIN `sales_order_int` AS `_table_customer_group_id` ON _table_customer_group_id.entity_id = e.entity_id AND _table_customer_group_id.attribute_id = 194
 LEFT JOIN `sales_order_int` AS `_table_customer_is_guest` ON _table_customer_is_guest.entity_id = e.entity_id AND _table_customer_is_guest.attribute_id = 203
 LEFT JOIN `sales_order_int` AS `_table_customer_note_notify` ON _table_customer_note_notify.entity_id = e.entity_id AND _table_customer_note_notify.attribute_id = 202
 LEFT JOIN `sales_order_int` AS `_table_edit_increment` ON _table_edit_increment.entity_id = e.entity_id AND _table_edit_increment.attribute_id = 110
 LEFT JOIN `sales_order_int` AS `_table_email_sent` ON _table_email_sent.entity_id = e.entity_id AND _table_email_sent.attribute_id = 204
 LEFT JOIN `sales_order_int` AS `_table_forced_do_shipment_with_invoice` ON _table_forced_do_shipment_with_invoice.entity_id = e.entity_id AND _table_forced_do_shipment_with_invoice.attribute_id = 503
 LEFT JOIN `sales_order_int` AS `_table_gift_message_id` ON _table_gift_message_id.entity_id = e.entity_id AND _table_gift_message_id.attribute_id = 463
 LEFT JOIN `sales_order_int` AS `_table_is_multi_payment` ON _table_is_multi_payment.entity_id = e.entity_id AND _table_is_multi_payment.attribute_id = 129
 LEFT JOIN `sales_order_int` AS `_table_payment_authorization_expiration` ON _table_payment_authorization_expiration.entity_id = e.entity_id AND _table_payment_authorization_expiration.attribute_id = 459
 LEFT JOIN `sales_order_int` AS `_table_paypal_ipn_customer_notified` ON _table_paypal_ipn_customer_notified.entity_id = e.entity_id AND _table_paypal_ipn_customer_notified.attribute_id = 504
 LEFT JOIN `sales_order_int` AS `_table_quote_address_id` ON _table_quote_address_id.entity_id = e.entity_id AND _table_quote_address_id.attribute_id = 114
 LEFT JOIN `sales_order_int` AS `_table_quote_id` ON _table_quote_id.entity_id = e.entity_id AND _table_quote_id.attribute_id = 113
 LEFT JOIN `sales_order_int` AS `_table_shipping_address_id` ON _table_shipping_address_id.entity_id = e.entity_id AND _table_shipping_address_id.attribute_id = 116
 SET `e`.`billing_address_id` = `_table_billing_address_id`.`value`, `e`.`can_ship_partially` = `_table_can_ship_partially`.`value`, `e`.`can_ship_partially_item` = `_table_can_ship_partially_item`.`value`, `e`.`customer_gender` = `_table_customer_gender`.`value`, `e`.`customer_group_id` = `_table_customer_group_id`.`value`, `e`.`customer_is_guest` = `_table_customer_is_guest`.`value`, `e`.`customer_note_notify` = `_table_customer_note_notify`.`value`, `e`.`edit_increment` = `_table_edit_increment`.`value`, `e`.`email_sent` = `_table_email_sent`.`value`, `e`.`forced_do_shipment_with_invoice` = `_table_forced_do_shipment_with_invoice`.`value`, `e`.`gift_message_id` = `_table_gift_message_id`.`value`, `e`.`is_multi_payment` = `_table_is_multi_payment`.`value`, `e`.`payment_authorization_expiration` = `_table_payment_authorization_expiration`.`value`, `e`.`paypal_ipn_customer_notified` = `_table_paypal_ipn_customer_notified`.`value`, `e`.`quote_address_id` = `_table_quote_address_id`.`value`, `e`.`quote_id` = `_table_quote_id`.`value`, `e`.`shipping_address_id` = `_table_shipping_address_id`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_datetime` AS `_table_customer_dob` ON _table_customer_dob.entity_id = e.entity_id AND _table_customer_dob.attribute_id = 206
 SET `e`.`customer_dob` = `_table_customer_dob`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_text` AS `_table_customer_note` ON _table_customer_note.entity_id = e.entity_id AND _table_customer_note.attribute_id = 201
 LEFT JOIN `sales_order_text` AS `_table_onestepcheckout_customercomment` ON _table_onestepcheckout_customercomment.entity_id = e.entity_id AND _table_onestepcheckout_customercomment.attribute_id = 545
 LEFT JOIN `sales_order_text` AS `_table_onestepcheckout_customerfeedback` ON _table_onestepcheckout_customerfeedback.entity_id = e.entity_id AND _table_onestepcheckout_customerfeedback.attribute_id = 546
 SET `e`.`customer_note` = `_table_customer_note`.`value`, `e`.`onestepcheckout_customercomment` = `_table_onestepcheckout_customercomment`.`value`, `e`.`onestepcheckout_customerfeedback` = `_table_onestepcheckout_customerfeedback`.`value`
; 
INSERT INTO `sales_flat_order_grid` (`entity_id`,`status`,`store_id`,`customer_id`,`base_grand_total`,`base_total_paid`,`grand_total`,`total_paid`,`increment_id`,`base_currency_code`,`order_currency_code`,`created_at`) SELECT `sales_flat_order`.`entity_id`, `sales_flat_order`.`status`, `sales_flat_order`.`store_id`, `sales_flat_order`.`customer_id`, `sales_flat_order`.`base_grand_total`, `sales_flat_order`.`base_total_paid`, `sales_flat_order`.`grand_total`, `sales_flat_order`.`total_paid`, `sales_flat_order`.`increment_id`, `sales_flat_order`.`base_currency_code`, `sales_flat_order`.`order_currency_code`, `sales_flat_order`.`created_at` FROM `sales_flat_order`
                        )
                )
            [3] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php
                    [line] => 946
                    [function] => run
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => INSERT INTO `sales_flat_order` (`entity_id`,`increment_id`,`store_id`,`created_at`,`updated_at`,`customer_id`,`tax_amount`,`shipping_amount`,`discount_amount`,`subtotal`,`grand_total`,`total_paid`,`total_refunded`,`total_qty_ordered`,`total_canceled`,`total_invoiced`,`total_online_refunded`,`total_offline_refunded`,`base_tax_amount`,`base_shipping_amount`,`base_discount_amount`,`base_subtotal`,`base_grand_total`,`base_total_paid`,`base_total_refunded`,`base_total_qty_ordered`,`base_total_canceled`,`base_total_invoiced`,`base_total_online_refunded`,`base_total_offline_refunded`,`subtotal_refunded`,`subtotal_canceled`,`discount_refunded`,`discount_canceled`,`discount_invoiced`,`tax_refunded`,`tax_canceled`,`shipping_refunded`,`shipping_canceled`,`base_subtotal_refunded`,`base_subtotal_canceled`,`base_discount_refunded`,`base_discount_canceled`,`base_discount_invoiced`,`base_tax_refunded`,`base_tax_canceled`,`base_shipping_refunded`,`base_shipping_canceled`,`subtotal_invoiced`,`tax_invoiced`,`shipping_invoiced`,`base_subtotal_invoiced`,`base_tax_invoiced`,`base_shipping_invoiced`,`shipping_tax_amount`,`base_shipping_tax_amount`,`shipping_tax_refunded`,`base_shipping_tax_refunded`,`base_total_invoiced_cost`,`protect_code`,`store_to_base_rate`,`store_to_order_rate`,`base_to_global_rate`,`base_to_order_rate`,`status`,`state`,`is_virtual`,`shipping_description`,`coupon_code`) SELECT `e`.`entity_id`, `e`.`increment_id`, `e`.`store_id`, `e`.`created_at`, `e`.`updated_at`, `e`.`customer_id`, `e`.`tax_amount`, `e`.`shipping_amount`, `e`.`discount_amount`, `e`.`subtotal`, `e`.`grand_total`, `e`.`total_paid`, `e`.`total_refunded`, `e`.`total_qty_ordered`, `e`.`total_canceled`, `e`.`total_invoiced`, `e`.`total_online_refunded`, `e`.`total_offline_refunded`, `e`.`base_tax_amount`, `e`.`base_shipping_amount`, `e`.`base_discount_amount`, `e`.`base_subtotal`, `e`.`base_grand_total`, `e`.`base_total_paid`, `e`.`base_total_refunded`, `e`.`base_total_qty_ordered`, `e`.`base_total_canceled`, `e`.`base_total_invoiced`, `e`.`base_total_online_refunded`, `e`.`base_total_offline_refunded`, `e`.`subtotal_refunded`, `e`.`subtotal_canceled`, `e`.`discount_refunded`, `e`.`discount_canceled`, `e`.`discount_invoiced`, `e`.`tax_refunded`, `e`.`tax_canceled`, `e`.`shipping_refunded`, `e`.`shipping_canceled`, `e`.`base_subtotal_refunded`, `e`.`base_subtotal_canceled`, `e`.`base_discount_refunded`, `e`.`base_discount_canceled`, `e`.`base_discount_invoiced`, `e`.`base_tax_refunded`, `e`.`base_tax_canceled`, `e`.`base_shipping_refunded`, `e`.`base_shipping_canceled`, `e`.`subtotal_invoiced`, `e`.`tax_invoiced`, `e`.`shipping_invoiced`, `e`.`base_subtotal_invoiced`, `e`.`base_tax_invoiced`, `e`.`base_shipping_invoiced`, `e`.`shipping_tax_amount`, `e`.`base_shipping_tax_amount`, `e`.`shipping_tax_refunded`, `e`.`base_shipping_tax_refunded`, `e`.`base_total_invoiced_cost`, `e`.`protect_code`, `e`.`store_to_base_rate`, `e`.`store_to_order_rate`, `e`.`base_to_global_rate`, `e`.`base_to_order_rate`, `e`.`status`, `e`.`state`, `e`.`is_virtual`, `e`.`shipping_description`, `e`.`coupon_code` FROM `sales_order` AS `e` WHERE (e.entity_type_id = '11'); 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_decimal` AS `_table_adjustment_negative` ON _table_adjustment_negative.entity_id = e.entity_id AND _table_adjustment_negative.attribute_id = 150
 LEFT JOIN `sales_order_decimal` AS `_table_adjustment_positive` ON _table_adjustment_positive.entity_id = e.entity_id AND _table_adjustment_positive.attribute_id = 149
 LEFT JOIN `sales_order_decimal` AS `_table_base_adjustment_negative` ON _table_base_adjustment_negative.entity_id = e.entity_id AND _table_base_adjustment_negative.attribute_id = 168
 LEFT JOIN `sales_order_decimal` AS `_table_base_adjustment_positive` ON _table_base_adjustment_positive.entity_id = e.entity_id AND _table_base_adjustment_positive.attribute_id = 167
 LEFT JOIN `sales_order_decimal` AS `_table_base_custbalance_amount` ON _table_base_custbalance_amount.entity_id = e.entity_id AND _table_base_custbalance_amount.attribute_id = 156
 LEFT JOIN `sales_order_decimal` AS `_table_base_shipping_discount_amount` ON _table_base_shipping_discount_amount.entity_id = e.entity_id AND _table_base_shipping_discount_amount.attribute_id = 516
 LEFT JOIN `sales_order_decimal` AS `_table_base_subtotal_incl_tax` ON _table_base_subtotal_incl_tax.entity_id = e.entity_id AND _table_base_subtotal_incl_tax.attribute_id = 523
 LEFT JOIN `sales_order_decimal` AS `_table_base_total_due` ON _table_base_total_due.entity_id = e.entity_id AND _table_base_total_due.attribute_id = 160
 LEFT JOIN `sales_order_decimal` AS `_table_custbalance_amount` ON _table_custbalance_amount.entity_id = e.entity_id AND _table_custbalance_amount.attribute_id = 138
 LEFT JOIN `sales_order_decimal` AS `_table_payment_authorization_amount` ON _table_payment_authorization_amount.entity_id = e.entity_id AND _table_payment_authorization_amount.attribute_id = 458
 LEFT JOIN `sales_order_decimal` AS `_table_shipping_discount_amount` ON _table_shipping_discount_amount.entity_id = e.entity_id AND _table_shipping_discount_amount.attribute_id = 515
 LEFT JOIN `sales_order_decimal` AS `_table_subtotal_incl_tax` ON _table_subtotal_incl_tax.entity_id = e.entity_id AND _table_subtotal_incl_tax.attribute_id = 522
 LEFT JOIN `sales_order_decimal` AS `_table_total_due` ON _table_total_due.entity_id = e.entity_id AND _table_total_due.attribute_id = 142
 LEFT JOIN `sales_order_decimal` AS `_table_weight` ON _table_weight.entity_id = e.entity_id AND _table_weight.attribute_id = 132
 SET `e`.`adjustment_negative` = `_table_adjustment_negative`.`value`, `e`.`adjustment_positive` = `_table_adjustment_positive`.`value`, `e`.`base_adjustment_negative` = `_table_base_adjustment_negative`.`value`, `e`.`base_adjustment_positive` = `_table_base_adjustment_positive`.`value`, `e`.`base_custbalance_amount` = `_table_base_custbalance_amount`.`value`, `e`.`base_shipping_discount_amount` = `_table_base_shipping_discount_amount`.`value`, `e`.`base_subtotal_incl_tax` = `_table_base_subtotal_incl_tax`.`value`, `e`.`base_total_due` = `_table_base_total_due`.`value`, `e`.`custbalance_amount` = `_table_custbalance_amount`.`value`, `e`.`payment_authorization_amount` = `_table_payment_authorization_amount`.`value`, `e`.`shipping_discount_amount` = `_table_shipping_discount_amount`.`value`, `e`.`subtotal_incl_tax` = `_table_subtotal_incl_tax`.`value`, `e`.`total_due` = `_table_total_due`.`value`, `e`.`weight` = `_table_weight`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_varchar` AS `_table_applied_rule_ids` ON _table_applied_rule_ids.entity_id = e.entity_id AND _table_applied_rule_ids.attribute_id = 118
 LEFT JOIN `sales_order_varchar` AS `_table_base_currency_code` ON _table_base_currency_code.entity_id = e.entity_id AND _table_base_currency_code.attribute_id = 121
 LEFT JOIN `sales_order_varchar` AS `_table_customer_email` ON _table_customer_email.entity_id = e.entity_id AND _table_customer_email.attribute_id = 195
 LEFT JOIN `sales_order_varchar` AS `_table_customer_firstname` ON _table_customer_firstname.entity_id = e.entity_id AND _table_customer_firstname.attribute_id = 197
 LEFT JOIN `sales_order_varchar` AS `_table_customer_lastname` ON _table_customer_lastname.entity_id = e.entity_id AND _table_customer_lastname.attribute_id = 199
 LEFT JOIN `sales_order_varchar` AS `_table_customer_middlename` ON _table_customer_middlename.entity_id = e.entity_id AND _table_customer_middlename.attribute_id = 198
 LEFT JOIN `sales_order_varchar` AS `_table_customer_prefix` ON _table_customer_prefix.entity_id = e.entity_id AND _table_customer_prefix.attribute_id = 196
 LEFT JOIN `sales_order_varchar` AS `_table_customer_suffix` ON _table_customer_suffix.entity_id = e.entity_id AND _table_customer_suffix.attribute_id = 200
 LEFT JOIN `sales_order_varchar` AS `_table_customer_taxvat` ON _table_customer_taxvat.entity_id = e.entity_id AND _table_customer_taxvat.attribute_id = 205
 LEFT JOIN `sales_order_varchar` AS `_table_discount_description` ON _table_discount_description.entity_id = e.entity_id AND _table_discount_description.attribute_id = 514
 LEFT JOIN `sales_order_varchar` AS `_table_ext_customer_id` ON _table_ext_customer_id.entity_id = e.entity_id AND _table_ext_customer_id.attribute_id = 112
 LEFT JOIN `sales_order_varchar` AS `_table_ext_order_id` ON _table_ext_order_id.entity_id = e.entity_id AND _table_ext_order_id.attribute_id = 111
 LEFT JOIN `sales_order_varchar` AS `_table_global_currency_code` ON _table_global_currency_code.entity_id = e.entity_id AND _table_global_currency_code.attribute_id = 120
 LEFT JOIN `sales_order_varchar` AS `_table_hold_before_state` ON _table_hold_before_state.entity_id = e.entity_id AND _table_hold_before_state.attribute_id = 104
 LEFT JOIN `sales_order_varchar` AS `_table_hold_before_status` ON _table_hold_before_status.entity_id = e.entity_id AND _table_hold_before_status.attribute_id = 103
 LEFT JOIN `sales_order_varchar` AS `_table_order_currency_code` ON _table_order_currency_code.entity_id = e.entity_id AND _table_order_currency_code.attribute_id = 123
 LEFT JOIN `sales_order_varchar` AS `_table_original_increment_id` ON _table_original_increment_id.entity_id = e.entity_id AND _table_original_increment_id.attribute_id = 109
 LEFT JOIN `sales_order_varchar` AS `_table_relation_child_id` ON _table_relation_child_id.entity_id = e.entity_id AND _table_relation_child_id.attribute_id = 107
 LEFT JOIN `sales_order_varchar` AS `_table_relation_child_real_id` ON _table_relation_child_real_id.entity_id = e.entity_id AND _table_relation_child_real_id.attribute_id = 108
 LEFT JOIN `sales_order_varchar` AS `_table_relation_parent_id` ON _table_relation_parent_id.entity_id = e.entity_id AND _table_relation_parent_id.attribute_id = 105
 LEFT JOIN `sales_order_varchar` AS `_table_relation_parent_real_id` ON _table_relation_parent_real_id.entity_id = e.entity_id AND _table_relation_parent_real_id.attribute_id = 106
 LEFT JOIN `sales_order_varchar` AS `_table_remote_ip` ON _table_remote_ip.entity_id = e.entity_id AND _table_remote_ip.attribute_id = 100
 LEFT JOIN `sales_order_varchar` AS `_table_shipping_method` ON _table_shipping_method.entity_id = e.entity_id AND _table_shipping_method.attribute_id = 130
 LEFT JOIN `sales_order_varchar` AS `_table_store_currency_code` ON _table_store_currency_code.entity_id = e.entity_id AND _table_store_currency_code.attribute_id = 122
 LEFT JOIN `sales_order_varchar` AS `_table_store_name` ON _table_store_name.entity_id = e.entity_id AND _table_store_name.attribute_id = 99
 LEFT JOIN `sales_order_varchar` AS `_table_x_forwarded_for` ON _table_x_forwarded_for.entity_id = e.entity_id AND _table_x_forwarded_for.attribute_id = 508
 SET `e`.`applied_rule_ids` = `_table_applied_rule_ids`.`value`, `e`.`base_currency_code` = `_table_base_currency_code`.`value`, `e`.`customer_email` = `_table_customer_email`.`value`, `e`.`customer_firstname` = `_table_customer_firstname`.`value`, `e`.`customer_lastname` = `_table_customer_lastname`.`value`, `e`.`customer_middlename` = `_table_customer_middlename`.`value`, `e`.`customer_prefix` = `_table_customer_prefix`.`value`, `e`.`customer_suffix` = `_table_customer_suffix`.`value`, `e`.`customer_taxvat` = `_table_customer_taxvat`.`value`, `e`.`discount_description` = `_table_discount_description`.`value`, `e`.`ext_customer_id` = `_table_ext_customer_id`.`value`, `e`.`ext_order_id` = `_table_ext_order_id`.`value`, `e`.`global_currency_code` = `_table_global_currency_code`.`value`, `e`.`hold_before_state` = `_table_hold_before_state`.`value`, `e`.`hold_before_status` = `_table_hold_before_status`.`value`, `e`.`order_currency_code` = `_table_order_currency_code`.`value`, `e`.`original_increment_id` = `_table_original_increment_id`.`value`, `e`.`relation_child_id` = `_table_relation_child_id`.`value`, `e`.`relation_child_real_id` = `_table_relation_child_real_id`.`value`, `e`.`relation_parent_id` = `_table_relation_parent_id`.`value`, `e`.`relation_parent_real_id` = `_table_relation_parent_real_id`.`value`, `e`.`remote_ip` = `_table_remote_ip`.`value`, `e`.`shipping_method` = `_table_shipping_method`.`value`, `e`.`store_currency_code` = `_table_store_currency_code`.`value`, `e`.`store_name` = `_table_store_name`.`value`, `e`.`x_forwarded_for` = `_table_x_forwarded_for`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_int` AS `_table_billing_address_id` ON _table_billing_address_id.entity_id = e.entity_id AND _table_billing_address_id.attribute_id = 115
 LEFT JOIN `sales_order_int` AS `_table_can_ship_partially` ON _table_can_ship_partially.entity_id = e.entity_id AND _table_can_ship_partially.attribute_id = 456
 LEFT JOIN `sales_order_int` AS `_table_can_ship_partially_item` ON _table_can_ship_partially_item.entity_id = e.entity_id AND _table_can_ship_partially_item.attribute_id = 457
 LEFT JOIN `sales_order_int` AS `_table_customer_gender` ON _table_customer_gender.entity_id = e.entity_id AND _table_customer_gender.attribute_id = 511
 LEFT JOIN `sales_order_int` AS `_table_customer_group_id` ON _table_customer_group_id.entity_id = e.entity_id AND _table_customer_group_id.attribute_id = 194
 LEFT JOIN `sales_order_int` AS `_table_customer_is_guest` ON _table_customer_is_guest.entity_id = e.entity_id AND _table_customer_is_guest.attribute_id = 203
 LEFT JOIN `sales_order_int` AS `_table_customer_note_notify` ON _table_customer_note_notify.entity_id = e.entity_id AND _table_customer_note_notify.attribute_id = 202
 LEFT JOIN `sales_order_int` AS `_table_edit_increment` ON _table_edit_increment.entity_id = e.entity_id AND _table_edit_increment.attribute_id = 110
 LEFT JOIN `sales_order_int` AS `_table_email_sent` ON _table_email_sent.entity_id = e.entity_id AND _table_email_sent.attribute_id = 204
 LEFT JOIN `sales_order_int` AS `_table_forced_do_shipment_with_invoice` ON _table_forced_do_shipment_with_invoice.entity_id = e.entity_id AND _table_forced_do_shipment_with_invoice.attribute_id = 503
 LEFT JOIN `sales_order_int` AS `_table_gift_message_id` ON _table_gift_message_id.entity_id = e.entity_id AND _table_gift_message_id.attribute_id = 463
 LEFT JOIN `sales_order_int` AS `_table_is_multi_payment` ON _table_is_multi_payment.entity_id = e.entity_id AND _table_is_multi_payment.attribute_id = 129
 LEFT JOIN `sales_order_int` AS `_table_payment_authorization_expiration` ON _table_payment_authorization_expiration.entity_id = e.entity_id AND _table_payment_authorization_expiration.attribute_id = 459
 LEFT JOIN `sales_order_int` AS `_table_paypal_ipn_customer_notified` ON _table_paypal_ipn_customer_notified.entity_id = e.entity_id AND _table_paypal_ipn_customer_notified.attribute_id = 504
 LEFT JOIN `sales_order_int` AS `_table_quote_address_id` ON _table_quote_address_id.entity_id = e.entity_id AND _table_quote_address_id.attribute_id = 114
 LEFT JOIN `sales_order_int` AS `_table_quote_id` ON _table_quote_id.entity_id = e.entity_id AND _table_quote_id.attribute_id = 113
 LEFT JOIN `sales_order_int` AS `_table_shipping_address_id` ON _table_shipping_address_id.entity_id = e.entity_id AND _table_shipping_address_id.attribute_id = 116
 SET `e`.`billing_address_id` = `_table_billing_address_id`.`value`, `e`.`can_ship_partially` = `_table_can_ship_partially`.`value`, `e`.`can_ship_partially_item` = `_table_can_ship_partially_item`.`value`, `e`.`customer_gender` = `_table_customer_gender`.`value`, `e`.`customer_group_id` = `_table_customer_group_id`.`value`, `e`.`customer_is_guest` = `_table_customer_is_guest`.`value`, `e`.`customer_note_notify` = `_table_customer_note_notify`.`value`, `e`.`edit_increment` = `_table_edit_increment`.`value`, `e`.`email_sent` = `_table_email_sent`.`value`, `e`.`forced_do_shipment_with_invoice` = `_table_forced_do_shipment_with_invoice`.`value`, `e`.`gift_message_id` = `_table_gift_message_id`.`value`, `e`.`is_multi_payment` = `_table_is_multi_payment`.`value`, `e`.`payment_authorization_expiration` = `_table_payment_authorization_expiration`.`value`, `e`.`paypal_ipn_customer_notified` = `_table_paypal_ipn_customer_notified`.`value`, `e`.`quote_address_id` = `_table_quote_address_id`.`value`, `e`.`quote_id` = `_table_quote_id`.`value`, `e`.`shipping_address_id` = `_table_shipping_address_id`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_datetime` AS `_table_customer_dob` ON _table_customer_dob.entity_id = e.entity_id AND _table_customer_dob.attribute_id = 206
 SET `e`.`customer_dob` = `_table_customer_dob`.`value`
; 
UPDATE `sales_flat_order` AS `e` LEFT JOIN `sales_order_text` AS `_table_customer_note` ON _table_customer_note.entity_id = e.entity_id AND _table_customer_note.attribute_id = 201
 LEFT JOIN `sales_order_text` AS `_table_onestepcheckout_customercomment` ON _table_onestepcheckout_customercomment.entity_id = e.entity_id AND _table_onestepcheckout_customercomment.attribute_id = 545
 LEFT JOIN `sales_order_text` AS `_table_onestepcheckout_customerfeedback` ON _table_onestepcheckout_customerfeedback.entity_id = e.entity_id AND _table_onestepcheckout_customerfeedback.attribute_id = 546
 SET `e`.`customer_note` = `_table_customer_note`.`value`, `e`.`onestepcheckout_customercomment` = `_table_onestepcheckout_customercomment`.`value`, `e`.`onestepcheckout_customerfeedback` = `_table_onestepcheckout_customerfeedback`.`value`
; 
INSERT INTO `sales_flat_order_grid` (`entity_id`,`status`,`store_id`,`customer_id`,`base_grand_total`,`base_total_paid`,`grand_total`,`total_paid`,`increment_id`,`base_currency_code`,`order_currency_code`,`created_at`) SELECT `sales_flat_order`.`entity_id`, `sales_flat_order`.`status`, `sales_flat_order`.`store_id`, `sales_flat_order`.`customer_id`, `sales_flat_order`.`base_grand_total`, `sales_flat_order`.`base_total_paid`, `sales_flat_order`.`grand_total`, `sales_flat_order`.`total_paid`, `sales_flat_order`.`increment_id`, `sales_flat_order`.`base_currency_code`, `sales_flat_order`.`order_currency_code`, `sales_flat_order`.`created_at` FROM `sales_flat_order`
                        )
                )
            [4] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 376
                    [args] => Array
                        (
                            [0] => /home/bestrcom/public_html/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php
                        )
                    [function] => include
                )
            [5] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 289
                    [function] => _modifyResourceDb
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => upgrade
                            [1] => 0.9.56
                            [2] => 1.4.0.21
                        )
                )
            [6] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 233
                    [function] => _upgradeResourceDb
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 0.9.56
                            [1] => 1.4.0.21
                        )
                )
            [7] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 161
                    [function] => applyUpdates
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                        )
                )
            [8] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/App.php
                    [line] => 363
                    [function] => applyAllUpdates
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ::
                    [args] => Array
                        (
                        )
                )
            [9] => Array
                (
                    [file] => /home/bestrcom/public_html/app/code/core/Mage/Core/Model/App.php
                    [line] => 295
                    [function] => _initModules
                    [class] => Mage_Core_Model_App
                    [type] => ->
                    [args] => Array
                        (
                        )
                )
            [10] => Array
                (
                    [file] => /home/bestrcom/public_html/app/Mage.php
                    [line] => 596
                    [function] => run
                    [class] => Mage_Core_Model_App
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [scope_code] => 
                                    [scope_type] => store
                                    [options] => Array
                                        (
                                        )
                                )
                        )
                )
            [11] => Array
                (
                    [file] => /home/bestrcom/public_html/index.php
                    [line] => 78
                    [function] => run
                    [class] => Mage
                    [type] => ::
                    [args] => Array
                        (
                            [0] => 
                            [1] => store
                        )
                )
        )
    [errorInfo] => Array
        (
            [0] => 23000
            [1] => 1062
            [2] => Duplicate entry '1' for key 1
        )
)