Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MS SQL Server Query Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
01487855
Message ID:
01487856
Vues:
77
This message has been marked as the solution to the initial question of the thread.
>I want to write an SQL script for MS SQL Server that would update data in one table with information in another table where the two tables relate on a common field. In FoxPro I would have just opened table1 and then did a scan loop. Inside the scan loop I would do an UPDATE to update the field in table2 with the information from a field in table1.
>
>So let's say we have the following:
>
>TABLE1.recid (related) TABLE2.recid
>TABLE1.field1 TABLE2.field2
>
>I want to update TABLE2.field2 with whatever is in TABLE1.field1 and the two tables are related by recid. Since I can't do a scan loop in the SQL Query, how would I accomplish this?
UPDATE Table1 SET Field1 = Table2.Field2
FROM Table1
INNER JOIN Table2 ON Tabel1.recid = Tabel2.recid
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform