Forum Moderators: open
update
products inner join products_categories on products_categories.pid = products.pid
SET products.price2 = products.price,
products.price = products.price*0.75
WHERE
products_categories.cid != "138"
AND
products_categories.cid != "128"
AND
products_categories.cid != "129"
AND
products_categories.cid != "130"
AND
products_categories.cid != "131"
AND
products_categories.cid != "133"
AND
products_categories.cid != "132"
I know you have joined them but it could be that the db wants the conditions to be set on the same table that you are performing the update on.
Try this.
update
products inner join products_categories on products_categories.pid = products.pid
SET products.price2 = products.price,
products.price = products.price*0.75
WHERE
products.cid != "138"
AND
products.cid != "128"
AND
products.cid != "129"
AND
products.cid != "130"
AND
products.cid != "131"
AND
products.cid != "133"
AND
products.cid != "132"
You can reduce the where clause to 1 statement like this:
update
products inner join products_categories on products_categories.pid = products.pid
SET products.price2 = products.price,
products.price = products.price*0.75
WHERE
products.cid not in (138, 128, 129, 130, 131, 133, 132)
[edited by: Demaestro at 7:36 pm (utc) on June 18, 2009]