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!
Views: 4,173
Zen Follower
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!
Administrator
jmberman:
What is the SQL code to set all product quantity to 1?
i know it's something like... UPDATE
productsSETproducts_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;
Zen Follower
Any idea why this isn't working?
UPDATE products SET products_quantity = 1000; WHERE products.master_categories_id = 58;
Administrator
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
Zen Follower
Ooooooh right! thank you!
Tell staff why this post should be reviewed.