Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Advanced SQL to update from insert
Message
De
25/01/2013 14:35:08
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01564084
Message ID:
01564135
Vues:
34
>It is part of the select columns list, in other words, you're selecting the PK from your version table using the above technique.

After the first SQL, I execute another SQL like this:
UPDATE Version SET NoVersionProduction=Temp2.Numero
FROM Version
JOIN
(
SELECT VersionProduction.Numero,VersionProduction.Date,Temp.Numero AS VersionNumero FROM VersionProduction
INNER JOIN (SELECT CAST(Version.Date AS Date) AS Date,Version.Numero
FROM Version
WHERE Version.Date>'1899-12-30 00:00:00.000') Temp
ON Temp.Date=CAST(VersionProduction.Date AS Date)
) Temp2 ON Temp2.VersionNumero=Version.Numero
This works.

As for the CTE, it this SQL ANSI?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform