youv youv - 8 months ago 24
SQL Question

Update column of one table from same table

I need to update one column of table with other from same table

UPDATE table
SET = table1.nickname
FROM table
WHERE userid = 5

Is there any problem in my query, please help.


Looks like you're adding some syntax you don't need...if all the data you need is already there in that table, simply do like so, irregardless of which flavor of SQL (I think--I could be wrong on that part):

UPDATE dbo.tablename
SET columnToChange = columnWithCorrectValue
WHERE userid = 5