i second that. travis
---- Original Message ---- From: "Raster, Tim" <[EMAIL PROTECTED]> Sent: 2003-02-06 To: SQL <[EMAIL PROTECTED]> Subject: RE: Update query question I just don't like subqueries. They are unclear to read, and are usually the source of more problems than they're worth. Just MHO. -----Original Message----- From: Phillip B [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 14:23 To: SQL Subject: Re: Update query question 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
