Zend certified PHP/Magento developer

Magento 2 join sales_order_item.product_id with catalog_product_entity.entity_id

After Migrating from Magento 1 to Magento 2.4.3 Community Edition the product_id row in the sales_order_item table is incorrect because the product ids are different to Mageto 1. (I imported the products with a CSV that’s why the ids are different)

Is it somehow possible to “fix” the table with a sql query by comparing the skus (they are the same) or something to replace the values with the correct id? And what value should be there for SKUs not existing anymore? Currently I updated the product_id values with NULL which is causing problems.

I have the problem, that the sales_clean_orders cron job is throwing an error “We can’t rebuild the index for an undefined product.” I believe because of the NULL value?