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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                        

Reply via email to