Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difficulty in understanding sql syntax

Status
Not open for further replies.

AtomicWedgie

IS-IT--Management
Jul 10, 2002
227
NL
Hi,

I have some SQL statements that were developped by someone else and I am having a very hard time in understanding what the syntax does. Could anybody enlighten me?


UPDATE Table_X
SET Field1 = (SELECT avg(FIELD1)
FROM Table_B
WHERE Table_A.FIELD2 = Table_B.FIELD2)
FROM Table_X Table_A
WHERE Table_A.Field3 = 'yyyy'


Regards,

AtomicWedgie

 
Field1 in TableX is being updated with the Average of Field1 in TableB where Field2 in TableA(alias for TableX) = Field2 in TableB

And that UPDATE is only being done on rows in Table_X where Field3 = 'yyyy'


Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top