Update entire column possible? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Update entire column possible?

Can you use entire columns from one table to update a column in another? UPDATE Products. quantity SET Stock.qty WHERE Product.id = Stock.id ;

27th Dec 2017, 4:42 PM
Samuel Petros
Samuel Petros - avatar
5 Answers
+ 2
That query is unfortunately wrong, you gave instruction to update Products table but at the same time gave a targeted field from Stock table, and there is no new value following the SET Stock.Qty. I might have misunderstood your point, but AFAIK it's a faulty SQL command. Can you give a little more information about what you want to achieve here, and probably, the tables structure so people here can offer suggestions or maybe, a solution : )
27th Dec 2017, 6:05 PM
Ipang
+ 2
Well that's tricky, it's between databases rather than tables now isn't it? I'm afraid it would take more than just a simple update statement to accomplish that. What steps have you tried anyway? and how did it go? I can try to help you find a solution maybe (no guarantee) in the meantime, you might want to look for a way to import the table from the old database into the new one.
27th Dec 2017, 8:21 PM
Ipang
+ 1
From which table to which table? is this an inventory data? how is the system flow if you don't mind me asking.
27th Dec 2017, 7:46 PM
Ipang
0
want to basically copy quantity amounts from one table to another
27th Dec 2017, 6:49 PM
Samuel Petros
Samuel Petros - avatar
0
k its just like moving the data from a old database to a new one that has the rest of the information already except quantity
27th Dec 2017, 7:58 PM
Samuel Petros
Samuel Petros - avatar