SQL for Quantity

Views: 4,173

Results 1 to 5 of 5
1 Mar 2026, 8:43 PM
#1
jmberman avatar

jmberman

Zen Follower

Join Date:
May 2016
Location:
Ohio
Posts:
422
Plugin Contributions:
0

SQL for Quantity

What is the SQL code to set all product quantity to 1?

i know it's something like... UPDATE products SET products_quantity = '1'

Thanks!

2 Mar 2026, 12:31 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: SQL for Quantity

jmberman:

What is the SQL code to set all product quantity to 1?

i know it's something like... UPDATE products SET products_quantity = '1'

Thanks!
The query you posted will work, in general, to set each and every product's price to 1.0000.

For more strict versions of MySQL, since the products_quantity field is a numeric value (not a string), I'd suggest

UPDATE products SET products_quantity = 1;

No quotes around that 1. The query will work in the admin's Tools / Install SQL Patches regardless of the site's DB_PREFIX, but phpMyAdmin requires the DB_PREFIX value (e.g. 'zen_', if set in the site's configure.php files):

UPDATE zen_products SET products_quantity = 1;

2 Mar 2026, 12:41 PM
#3
jmberman avatar

jmberman

Zen Follower

Join Date:
May 2016
Location:
Ohio
Posts:
422
Plugin Contributions:
0

Re: SQL for Quantity

Any idea why this isn't working?

UPDATE products SET products_quantity = 1000; WHERE products.master_categories_id = 58;

2 Mar 2026, 12:46 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: SQL for Quantity

jmberman:

Any idea why this isn't working?

UPDATE products SET products_quantity = 1000; WHERE products.master_categories_id = 58;
Because you've got a stray semi-colon

2 Mar 2026, 12:47 PM
#5
jmberman avatar

jmberman

Zen Follower

Join Date:
May 2016
Location:
Ohio
Posts:
422
Plugin Contributions:
0

Re: SQL for Quantity

Ooooooh right! thank you!