I have 2 tables:
Table Subcat which has the following fields:
(catid, subcatcode, subcatname,...)
Table Products which has the following fields:
(productid, productname, catid, subcatname, subcatid (this field has nothing in it yet))
What I want to do is the following:
populate the field subcatid in the table products from the field subcatcode in the table Subcat based on 2 conditions,
the conditions are: when the catid from both tables are equal and when the subcatname fields are equal.
All I need is the SQL query. Any help from the SQL expert out there is appreciated. Thanks in advance.
INSERT INTO products (subcatid) SELECT column FROM other_table WHERE field = criteria;
I'd make a copy of any table before getting to grips with these queries, it's easy to mistype the query and find yourself adding data to where you shoudnt....