Hello, im a beginner at sql and i am struggling at comparing data from one table to another and then copying other data.
*I have 2 tables both of which have 2 columns with the same name lets call them tableA and tableB.
* tableA has a column id and tableb has a columnid
* and i want to insert the item name thats in tableA into the empty column in tableB
INSERT INTO tableb (itemname) SELECT tableA.itemName,itemA.ID as a_role,tableB.ID as b_role FROM tableA,tableB WHERE a_role=b_role
But this throws me an error saying : #1054 - Unknown column 'a_role' in 'where clause'
Anyone any idea how to accomplish this seemingly simple task? Iv spent a long time googling solutions and i done think im far away from an answer but any help would be nice :)