Post by IT-Me-Up.co.uk » Fri Jan 11, 2019 5:57 pm

Hi there,

I have imported some products with some incorrect stock status, would this SQL work?

UPDATE `itmeup_product`
SET stock_status_id = CASE
WHEN quantity=0 THEN 5*stock_status_id
ELSE stock_status_if
END

If Quantity is = then set Stock Status 5 = (Out of Stock)
Currently its is showing as 6 (2-3 Days)

Please Check Out My Site:
https://www.IT-Me-Up.co.uk/


New member

Posts

Joined
Thu Sep 21, 2017 4:27 pm

Post by xxvirusxx » Fri Jan 11, 2019 7:06 pm

Why dont' use something like this?

Code: Select all

UPDATE `itmeup_product` SET stock_status_id = X  WHERE quantity = 0;
or

Code: Select all

UPDATE `itmeup_product` SET stock_status_id = X  WHERE quantity = 0 AND something_else = Y;
etc...

Is weird to ask for 20 years experience in IT :)

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România
Who is online

Users browsing this forum: khnaz35, Majestic-12 [Bot], Semrush [Bot] and 50 guests