SQL Query help required

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/69187?pagenum=1
05 November 2025, 11:10

Topic


Webbo
SQL Query help required
17 February 2010, 17:59


I want to update a range of products within a MySql database using phpMyAdmin

The SQL Query I'm using is:

UPDATE `products` SET `manufacturers_id` = '1' WHERE `products`.`products_id` = 3 LIMIT 1;


What I'd like to do is place a range in place of '3' in 'products.products_id'=

So that I can update a range of ID's at once instead of doing them all individually. Can someone please show me how?
Thanks

 

Replies ...


Shaggy
18 February 2010, 05:48


One solution is to use the IN operator and provide a comma separated list of the record you wish to update:
Code:
UPDATE TABLE SET FIELD1='value' WHERE FIELD2 IN (comma,separated,list,of,values)
Webbo
19 February 2010, 17:53


Thanks Shaggy, worked a treat :)
Shaggy
22 February 2010, 05:12


You're welcome, Webbo smile
© 2000-2021 Snitz™ Communications