brgdotnet
asked on
question about inner join syntax
I have been given this pseudo code in order to write my query. The pseudo code is from someone who is not really strong at SQL, however this persons hase a pretty good idea of what she wants.
So here is the pseudo code.
UPDATE Customer
SET Customer.Id = CopyCust.Id,
Customer.IsCurrent = CopyCust.IsCurrent
FROM Customer
INNER JOIN CopyCust
ON
Customer.Code = CopyCust.Code
Customer.SSN = CopyCust.SSN
Customer.LastName = Customer.FirstName
I don't think you can join on several columns at one time. So, What I really think she wanst is the following solution: (What do you think Experts)
UPDATE Customer
SET Customer.Id = CopyCust.Id,
Customer.IsCurrent = CopyCust.IsCurrent
FROM Customer
INNER JOIN CopyCust
ON
Customer.Code = CopyCust.Code
WHERE
Customer.SSN = CopyCust.SSN
AND Customer.LastName = Customer.FirstName
So here is the pseudo code.
UPDATE Customer
SET Customer.Id = CopyCust.Id,
Customer.IsCurrent = CopyCust.IsCurrent
FROM Customer
INNER JOIN CopyCust
ON
Customer.Code = CopyCust.Code
Customer.SSN = CopyCust.SSN
Customer.LastName = Customer.FirstName
I don't think you can join on several columns at one time. So, What I really think she wanst is the following solution: (What do you think Experts)
UPDATE Customer
SET Customer.Id = CopyCust.Id,
Customer.IsCurrent = CopyCust.IsCurrent
FROM Customer
INNER JOIN CopyCust
ON
Customer.Code = CopyCust.Code
WHERE
Customer.SSN = CopyCust.SSN
AND Customer.LastName = Customer.FirstName
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
They buy you nothing besides trading readability for keystrokes.
We will have to agree to disagree. In my view the version I posted is far more readable.
We will have to agree to disagree. In my view the version I posted is far more readable.
Igyftw.
I will have to take your word for it, as I have no idea what that means.
I suggest you stay with your aesthetic and clean way of writing code, unless you decide for yourself to use abbreviations as aliases. They buy you nothing besides trading readability for keystrokes.