PDA

View Full Version : Help with query to select products and change weight


oskare100
02-06-2008, 12:55 PM
Hello,
I've a table with several columns. One of the colums is "products_id" which contains an ID assaigned to each product. Another column is "products_weight".

What I can't figure out is: I need to change all values in the "products_weight" column to a specified value for all "products_id"'s between for example 30 and 100.

So select all "products_id" between for example 30 and 100, then change all "products_weight" for those "products_id"'s to a specified value/weight....

Thanks,
Oskar

abduraooft
02-06-2008, 01:09 PM
update table_name set products_weight=50 where products_id between 30 and 100 ??

Andrew Johnson
02-06-2008, 11:52 PM
UPDATE table SET products_weight=7 WHERE product_id>30 AND product_id<100


You may need to change the actual numberic value for products_weight and/or the less than and greater than symbols to equal or less than and equal or greater than. You weren't extremely descriptive so I just took a guess...