Use of SQL SET command to create file alias

K

KarenSue

I have inherited an application from another programmer. Could someone
explain why alias 'a' and 'b', below, are merely listed after the UPDATE
command but for alias 'c', the SET command is used? I thought the SET
command is used to 'set' one field equal to the value in another, as used in
the second instance of SET, below.

UPDATE Combined_Status AS a, Keywords AS b SET Group_Sort AS c
SET a.sort_flag = c.minimum_sort

Thank you from a rusty query writer trying to brush up her skills.
 
B

Bob Barrows

KarenSue said:
I have inherited an application from another programmer. Could
someone explain why alias 'a' and 'b', below, are merely listed after
the UPDATE command but for alias 'c', the SET command is used? I
thought the SET command is used to 'set' one field equal to the value
in another, as used in the second instance of SET, below.

UPDATE Combined_Status AS a, Keywords AS b SET Group_Sort AS c
SET a.sort_flag = c.minimum_sort

Thank you from a rusty query writer trying to brush up her skills.
That does not appear to be a legal statement. The SET keyword should
only be used once in an UPDATE statement. It has nothing to do with
tables or assigning aliases. It is used to signal the start of the
clause where values are assigned to columns.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top