0

I'm looking for a query to get all my products that have "qty > 2 and 'stock availability = 0'" and change the stock availability to 1.

A crash on my inventory update routine did a mess on my inventory and there are more than 7000 products, impossible to check one by one. :(

0

SOLVED

I ran this queries:

SELECT p.sku, s.qty, s.min_qty, s.is_in_stock FROM "catalog_inventory_table" s inner join catalog_product_entity p on s.product_id = p.entity_id where s.qty

SELECT p.sku, s.product_id, s.qty, s.min_qty, s.is_in_stock FROM "catalog_inventory_table" s inner join catalog_product_entity p on s.product_id = p.entity_id where s.qty >= s.min_qty

UPDATE "catalog_inventory_table" SET is_in_stock = 1 WHERE qty >= min_qty AND qty > 0;

where "catalog_inventory_table" is my catalog inventory table name :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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