I am trying to update multiple rows with different values, but don’t need to match any specific ID.
Of course, both columns on two different tables will have a same number of records.
Example, I have a table Table1 and Column1 and a query with list 10 items in that table (the ID is not consecutive).
ID ItemName
1 Item1
2 Item2
4 Item3
5 Item4
6 Item5
8 Item6
9 Item7
14 Item8
18 Item9
23 Item10
Now, I have another table Table2 and Column2 that I want to update with those 10 items above.
This also has different IDs, but ItemName is blank/null value.
ID ItemName
301 NULL
321 NULL
323 NULL
331 NULL
333 NULL
335 NULL
336 NULL
355 NULL
377 NULL
388 NULL
So, I a looking for a query where I can update the Table2 and Column2 with those 10 items from Table1, and the result looks like this
ID ItemName
301 ITem1
321 ITem2
323 ITem3
331 ITem4
333 ITem5
335 ITem6
336 ITem7
355 ITem8
377 ITem9
388 ITem10
Please help. Thanks in advance.
SQL Fiddle