Home:ALL Converter>How do I UPDATE from a SELECT in SQL command?

How do I UPDATE from a SELECT in SQL command?

Ask Time:2018-06-08T21:53:44         Author:Kith

Json Formatter

I need to update Book table and Stock table at the same time using a single query. Because ISBN_No in Book table is equal to ISBN_No in stock table. I would like to know how to put below query inside of the existing update statement.

UPDATE Table_A
SET Table_A.ISBN_No = Table_B.ISBN_No,
FROM TBL_Book AS Table_A
INNER JOIN TBL_Stock AS Table_B ON Table_A.ISBN_No = Table_B.ISBN_No
WHERE Table_A.ISBN_No = 'datagridview column name'

Author:Kith,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50762217/how-do-i-update-from-a-select-in-sql-command
yy