Thanks for that guys. -----Original Message----- From: Neven MacEwan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 2 October 2001 10:56 To: Multiple recipients of list delphi Subject: Re: [DUG]: Update SQL Syntax
My thoughts exactly, safest UPDATE SHDayD SET Department = (select max(Department) from product where SHDayD.ScanCode = Product.ScanCode) Neven ----- Original Message ----- From: "Myles Penlington" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 10:46 AM Subject: RE: [DUG]: Update SQL Syntax > Also this will work, but need to be careful that only a singleton is > returned, so may need some more qualification in the select part. > > UPDATE SHDayD > SET Department = (select Department from product where SHDayD.ScanCode > = > Product.ScanCode) > > Myles. > > > -----Original Message----- > From: David Brennan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, 2 October 2001 10:41 a.m. > To: Multiple recipients of list delphi > Subject: Re: [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) > > > Depends a bit on which version of SQL you are using but the following would > work on SQL Server: > > UPDATE SHDayD > SET Department = Product.Department > FROM Product > WHERE (SHDayD.ScanCode = Product.ScanCode) > > David. > > ---------------------------------------------------------------------- > ---- - > 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/ > --------------------------------------------------------------------------- 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/