How do I UPDATE from a SELECT in SQL Server UPDATE from SELECT with INNER JOIN in SQL Database. Since there are too many replies of this post, which are most heavily up voted, I thought I would provide my suggestion here too. Although the question is very interesting, I have seen in many forum sites and made a solution using INNER JOIN with screenshots. At first, I have created a table named with schoolold and inserted few records with respect to their column names and execute it. Then I executed SELECT command to view inserted records. Then I created a new table named with schoolnew and similarly executed above actions on it. Then, to view inserted records in it, I execute SELECT command. Now, Here I want to make some changes in third and fourth row, to complete this action, I execute UPDATE command with INNER JOIN. To view the changes I execute the SELECT command. You can see how Third and Fourth records of table schoolold easily replaced with table schoolnew by using INNER JOIN with UPDATE statement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |