Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ppatel112
Starting Member
35 Posts |
Posted - 2013-10-02 : 01:19:11
|
Hi Folks,i am using 4 tables company, users, ARSAP, ARCUS to update a column in company table.the tsql i am using is below.UPDATE c SET c.comp_primaryuserid = u.user_useridFROM Company c, Users uLEFT JOIN SAMINC.dbo.ARSAP z on z.NAMEEMPL = 'u.user_firstname u.user_lastname'LEFT JOIN SAMINC.dbo.ARCUS y on z.CODESLSP = y.CODESLSP1 WHERE y.IDCUST = c.comp_companyidthe validation "LEFT JOIN SAMINC.dbo.ARSAP z on z.NAMEEMPL = 'u.user_firstname u.user_lastname'" is not working though the sql is correct, there is no relation between ARSAP table and users table.I just want to match the firstname lastname from column NAMEEMPL (table ARSAP) to users table user_firstname user_lastname.i am stuck at this point and i cant update c.comp_primaryuserid = u.user_userid to fix this up.any ideas to help?regards,parth |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2013-10-02 : 06:17:37
|
Is this what you mean?LEFT JOIN SAMINC.dbo.ARSAP z on z.NAMEEMPL = u.user_firstname + ' ' + u.user_lastnameIs NAMEEMPLE always firstname <space> lastname?Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|