Updating a table from another table | UPDATE SELECT FROM | SQL Server

preview_player
Показать описание
This video shows the different methods that can be used to update from a select clause in SQL server, specifically how to update from a different table.

You can update a table using a row of static values and assign them to appropriate fields, but if you want to update a set of rows in one table from the contents of another there are a few different methods and techniques to accomplish this

In the video I go over how to update using a FROM and WHERE clause, a table JOIN clause, and how to use the MERGE and a common table expression to update tables from other tables.



Video Chapters

00:00 Introduction
00:45 Example table data
01:05 UPDATE using a FROM clause
02:00 UPDATE using a table JOIN
03:02 UPDATE using the MERGE clause
04:03 UPDATE from a CTE
05:02 Outro
Рекомендации по теме
Комментарии
Автор

Hands down the most precise and clear explanation of the update with join.... Thank you sir!

official-DRFRE
Автор

Good Explanation, You save me today Thank you very much

gantamahesh
Автор

Great information. Thank You! A question though.. at 01:53 why are there no square brackets around SalesPerson from the [Sales] table?

_indrid_cold_
Автор

You saved my day. Thanks and god bless you.

hnulu
Автор

Excellent job, clear explanation, keep it up

ricgee
Автор

good work, imo the best by far among many around here on YT, the animation is quite impressive

StefanoVerugi
Автор

I had summary (view) table come from detail table(A), I make trigger function on PostgreSQL to capture value in the table_summary(view) and insert/auto update value into master table(B) . I tried to create this trigger but I did not get the result.

Do have any options to insert or update value to master table(b)?

Thanks you for support

P.R.RacerX-Studio
Автор

Hello there. I just wanted to know if the from clause is supported in mysql.
I am actually trying to use the from clause but everytime I get a syntax error in the from clause. I have checked everything and can't actually find the syntax error.

Sanju-moin
Автор

When I do the update at 2:00, the records in my table are updated to be all the same yet there is a variety of different names in the table I’m updating from. Why is that?
Also I’ve tried different ways to update and all generate same incorrect result

michaelsaab
Автор

Sorry this is a question for an old table, but do the tables need to be indexed?

cjones
Автор

why use aliases when trying to explain a basic concept? It's not necessary is it? Just confuses me more. Like, do I have to give my table an alias for this to work? But everyone does it when explaining Update.

MarkPryor
welcome to shbcf.ru