SQl Update from table of random Names

后端 未结 2 2098
栀梦
栀梦 2021-01-26 10:23

I Have a table of random names, simply 3 columns(id, firstname, lastname).

I am trying to have SQL update an entire table of names

2条回答
  •  失恋的感觉
    2021-01-26 10:41

    update
    TestNames left join 
    (select ID,
    floor(1+(rand()*600)) as rndid
    from TestNames) as TN on TN.ID=TestNames.id
    left join rndnames on TN.rndid=rndnames.id
    set TestNames.fname=rndnames.FirstName,TestNames.lname=rndnames.LastName
    

提交回复
热议问题