MySQL update query involving two tables is not working, ...really stumped!
i'm really stumped why this SQL statement is not working. I guess my MySQL has gotten rusty.
The error i'm getting is this.
UPDATE mscanproducts SET mscanproducts.manufacturers_id = 37 where
mscanproducts.products_id = mscanproducts_to_categories.products_id and mscanproducts_to_categories.categories_id = 5;
but i'm sure the column and table do exist
Unknown column 'mscanproducts_to_categories.products_id' in 'where clause'
i'll try to briefly to describe the tables
products_id | manufactures_id
1 | null
products_id | categories_id
1 | 5
Last edited by toptomato; 01-23-2014 at 04:13 PM.
Correction, that is NOT working.
UPDATE mscanproducts SET manufacturers_id = 37 where products_id = (select products_id from mscanproducts_to_categories where categories_id = 5);
the error i'm getting is
#1242 - Subquery returns more than 1 row
which is what i want, i want more than 1 row updated,... hmmmmmm
Last edited by toptomato; 01-23-2014 at 04:35 PM.
... where products_id IN (select ...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread