Magento2: update product attributes using sql

cat update_product_attributes_using_sql.sql
update catalog_product_entity_int -- select * from catalog_product_entity_int
set catalog_product_entity_int.value = 1
where (catalog_product_entity_int.attribute_id = 97) and catalog_product_entity_int.entity_id = (
select entity_id from (
SELECT product.entity_id as entity_id FROM bitnami_magento.catalog_product_entity product
inner join catalog_product_entity_decimal price on price.entity_id = product.entity_id and (price.attribute_id in (78))
inner join catalog_product_entity_int status_t on (status_t.entity_id = product.entity_id) and (status_t.attribute_id=97)
where (price.value >= 20 and price.value <= 21)
and (status_t.value = 1)

Leave a Reply