SQL Query help required - نوشته شده در (1465 Views)
Average Member
Webbo
مطلب: 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
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Support Moderator
Shaggy
مطلب: 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.”
نوشته شده در
Average Member
Webbo
مطلب: 982
982
Thanks Shaggy, worked a treat :)
نوشته شده در
Support Moderator
Shaggy
مطلب: 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.”
 
شما باید یک متن وارد کنید