Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 SQL Query help required
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Webbo
Average Member

United Kingdom
982 Posts

Posted - 17 February 2010 :  17:59:45  Show Profile  Visit Webbo's Homepage  Reply with Quote
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

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 18 February 2010 :  05:48:52  Show Profile  Reply with Quote
One solution is to use the IN operator and provide a comma separated list of the record you wish to update:
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.”
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 19 February 2010 :  17:53:00  Show Profile  Visit Webbo's Homepage  Reply with Quote
Thanks Shaggy, worked a treat :)
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 22 February 2010 :  05:12:49  Show Profile  Reply with Quote
You're welcome, Webbo


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.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.41 seconds. Powered By: Snitz Forums 2000 Version 3.4.07