sql - Update all column values in a table with a column value of another table (related by a foreign key) -


I'm trying to populate a new column in the table with data in columns of another table.

  UPDATE dbo.PackageSessionNodes SET Created_By = (dbo.PackageSessions, select dbo.PackageSessionNodes, where dbo.PackageSessions.PackageSessionId = dbo.PackageSessionNodes.PackageSessionId)  
< p> the update puts fails because re-created more than one value of the subkey I obviously am a SQL Nob, so would appreciate any help.

Thx!

I think you are looking for this syntax:

 < code> update dbo.PackageSessionNodes Set_B_B = left dbo.PackageSessionNodes pn from p.userid dbo.PackageSessions p on p.PackageSessionId = pn PackageSessionId  

I believe that only a PackageSessionNode the Packejaseshn be?


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -