Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
JOIN vs. WHERE in an UPDATE statement
Message
De
21/06/2007 08:48:20
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
JOIN vs. WHERE in an UPDATE statement
Divers
Thread ID:
01234659
Message ID:
01234659
Vues:
36
Hi,

A quick question for the SQL-experienced. Which way is preferable to link two tables in an UPDATE statement, a JOIN or a WHERE clause - or is there a notable difference? I've always leaned towards using JOINs, but a colleague is pushing the other way. Is there a best practice that applies here?
UPDATE	#TMPACCT 
SET		CurrentDeliveryDate = TMP2.ActualDeliveryDate
		,LastDeliveryCost = 1
FROM	#TMPACCT2 TMP2
	INNER JOIN #TMPACCT TMP ON TMP.OrderID = TMP2.OrderID and TMP2.DescType = 0
- OR -
UPDATE	#TMPACCT 
SET		CurrentDeliveryDate = TMP2.ActualDeliveryDate
		,LastDeliveryCost = 1
FROM	#TMPACCT2 TMP2
	WHERE #TMPACCT.OrderID = TMP2.OrderID and TMP2.DescType = 0
Thanks in advance,
Jay
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform