Simple-ish SQL Script required !!
#1
Moderator
Thread Starter
iTrader: (5)
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes
on
0 Posts
Can someone help me out with a simple SQL script to update a table ?
You can ? Great ! Okay here's the details . . . .
I need to update the field called Box_Contents in a table called boxes051001 with the data held in a field of the same name in a table called boxes403010 where the field barcode matches in both tables.
Probably really simple, but its Friday
You can ? Great ! Okay here's the details . . . .
I need to update the field called Box_Contents in a table called boxes051001 with the data held in a field of the same name in a table called boxes403010 where the field barcode matches in both tables.
Probably really simple, but its Friday
#2
Scooby Regular
just a guess but along the lines of:
dim var1, var2, var3, var4
var1 = boxes051001.Box_Contents
var2 = boxes403010.Box_Contents
var3 = boxes051001.barcode
var4 = boxes403010.barcode
update var1 values (var2) where var3 = var4
Just a guess as I am still learning this stuff - Fosters/Chiark are your men
Box_Contents in a table called boxes051001 with the data held in a field of the same name in a table called boxes403010 where the field barcode matches in both tables.
[Edited by Dream Weaver - 8/23/2002 12:16:46 PM]
dim var1, var2, var3, var4
var1 = boxes051001.Box_Contents
var2 = boxes403010.Box_Contents
var3 = boxes051001.barcode
var4 = boxes403010.barcode
update var1 values (var2) where var3 = var4
Just a guess as I am still learning this stuff - Fosters/Chiark are your men
Box_Contents in a table called boxes051001 with the data held in a field of the same name in a table called boxes403010 where the field barcode matches in both tables.
[Edited by Dream Weaver - 8/23/2002 12:16:46 PM]
#6
try this...
update boxes051001 set boxes051001.box_contents = boxes403010.box_contents from boxes051001,boxes403010 where boxes051001.barcode = boxes403010.barcode
Difficult to test here without the tables
update boxes051001 set boxes051001.box_contents = boxes403010.box_contents from boxes051001,boxes403010 where boxes051001.barcode = boxes403010.barcode
Difficult to test here without the tables
#7
update boxes051001 set Box_Contents =
(select Box_Contents from boxes403010
where boxes403010.barcode = boxes051001.barcode)
I think (This is coming from an Oracle point of view, but think it would work even if it's SQL Server you're after)
And remember to commit!
(select Box_Contents from boxes403010
where boxes403010.barcode = boxes051001.barcode)
I think (This is coming from an Oracle point of view, but think it would work even if it's SQL Server you're after)
And remember to commit!
Trending Topics
Thread
Thread Starter
Forum
Replies
Last Post
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM