So my subquery is crap uh? ;) Just kidding. I don't know why I didn't think of the join method. I think I'll try it since its easier to read.
Phillip B ----- Original Message ----- From: "Raster, Tim" <[EMAIL PROTECTED]> To: "SQL" <[EMAIL PROTECTED]> Sent: Thursday, February 06, 2003 2:07 PM Subject: RE: Update query question > I prefer the join method, rather than that subquery crap. > > Update a > Set MyField = b.MyField > >From tblA a inner join tblB b on a.ID = b.ID > > > -----Original Message----- > From: Phillip B [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 14:00 > To: SQL > Subject: Update query question > > I need to set the value of one field in table tblA to the value in table > tblB with id being the same in both tables. Would this work? > > > > UPDATE > tblA > SET > brand = (SELECT > brand > FROM > tblB > WHERE > tblB.id= tblA.id) > > I'm using SQL2000. > > Phillip B > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6 Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
