I have two tables. Table 1
has about 80 rows and Table 2
has about 10 million.
I would like to update all the rows in Table 2
with a random row from Table 1
. I don't want the same row for all the rows. Is it possible to update Table 2
and have it randomly select a value for each row it is updating?
This is what I have tried, but it puts the same value in each row.
update member_info_test
set hostessid = (SELECT TOP 1 hostessId FROM hostess_test ORDER BY NEWID())
**Edited