I wish to update special_price to existing price in magento 2. How do I do it?
price and special_price attribute both are stored in table catalog_product_entity_decimal with attribute_code 74 and 75.
catalog_product_entity_decimal table
Now I've to update 1349 (the value of entity_id=9773 and attribute_id=75) to 1619 (value of entity_id=9773 and attribute_id=74)
Similarly, want to update the value of entity_id=9774 and attribute_id=75 to 1619 from 1349.
Every entity may have different value for each attribute_id.
I need sql update statement which updates value of such 200,000 entities in the table at one go. This sql will update price and special_price to each other in one sql statement for all the products in magento 2.
I tried to run this sql but did not work:
UPDATE catalog_product_entity_decimal val
SET val.value = (SELECT value FROM catalog_product_entity_decimal WHERE attribute_id = '74' and entity_id='9773')
WHERE val.attribute_id = '75' and val.entity_id='9773'
The error says "select cannot be from same table"