SQL Query help required - Posted (1464 Views)
Average Member
Webbo
Posts: 982
982
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
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Support Moderator
Shaggy
Posts: 6780
6780
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)
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Average Member
Webbo
Posts: 982
982
Thanks Shaggy, worked a treat :)
Posted
Support Moderator
Shaggy
Posts: 6780
6780
You're welcome, Webbo smile
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
 
You Must enter a message