In TABLE 1 (LEFT SIDED), I have lists of words in a column(WordEng) and each of them have unique IDs listed parallel in another column(WordEngID).
In TABLE 2 (RIGHT SIDED), I have lists of word IDs, which is nothing but unique IDs of words in TABLE 1. I want to copy words from TABLE 1 into a column in TABLE 2 according to its unique IDs. In Table 1 no words have same IDs and in Table 2 the same IDs are in different rows.
For example,
there is a word "cut" with ID "1807" in Table 1 and I want to copy and paste it in the column "words" in Table 2 which have IDs "1807"(five in this case).
You need this UPDATE
statement:
UPDATE Table2
SET words = (SELECT t1.WrdEng FROM Table1 t1 WHERE t1.WrdEngId = Table2.WrdEngId)
WHERE words IS NULL
If you want all the values of words
updated, even if they are not null
, then remove the WHERE
clause.