Reputation: 197
I have a table (in phpmyadmin) that i want to update.
The table is called categories, which has fields ID, Name & sid
I want to update the Name column with the value contained in the table called vocabulary.
Vocabulary contains sid, langid & value
I have worked out the select join statement as follows:
Select categories.ID, vocabulary.value
FROM categories
Inner join vocabulary
on categories.sid = vocabulary.sid
where langid = 1;
However, as i said, i want to update the name field in categories with the corrosponding value from vocabulary.
So i have tried a number of queries but none seem to work
Update categories
set cateogires.Name = vocabulary.value
Inner join vocabulary
on categories.sid = vocabulary.sid
where langid = 1;
Any ideas?
Upvotes: 1
Views: 3102
Reputation: 263693
The INNER JOIN
is part of the UPDATE
clause in MySQL
(you have mentioned phpmyadmin).
UPDATE Categories a
INNER JOIN Vocabulary b
ON a.sid = b.sid
SET a.Name = b.value
WHERE b.langID = 1
Upvotes: 2