James As stated by David it depends on the Server but you can try
a/ (MS SQL SERVER) UPDATE SHDayD SET Department = Product.Department FROM SHDayD, Product WHERE SHDayD.ScanCode = Product.ScanCode (I think Davids version was wrong) OR b/ Generic Subselect UPDATE SHDayD SET Department = (SELECT Department FROM Product WHERE SHDayD.ScanCode = ScanCode) Also beware of the following 1/ Cardinality, b will fail if the Department.Scancode is non-unique 2/ NULLs depending on the server, b may return Blank or NULL HTH Neven ----- Original Message ----- From: "James Sugrue" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 10:20 AM Subject: [DUG]: Update SQL Syntax > What is the syntax for an update query if I want to reference another table > ? > > I.E > > UPDATE SHDayD > SET Department = Product.Department > WHERE (ScanCode = Product.ScanCode) > > But it doesny work. > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/