Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you do an UPDATE like this?
Message
De
23/02/2000 11:04:17
 
 
À
23/02/2000 10:50:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00336023
Message ID:
00336044
Vues:
26
Thanks John.
It would have been neat to do this with an UPDATE (only on line of code) but well you can't get everything.
Must have read this in the ANSI SQL book. I know I've seen this UPDATE somewhere. Well never gonna know I spose.

>You cannot use JOIN in an UPDATE in either VFP or SQL Server (Can't figure out which you are trying). UPDATEs are for a single table only. If in VFP, you can do the following (works best if you have an index on "field"):
>
>USE tab1 IN 0 ORDER field
>USE tab2 IN 0 ORDER field
>SELE tab1
>SET RELA TO field INTO tab2
>REPLACE tab1.field WITH tab2.field
>
>
>>I'm trying to write an SQL UPDATE but I'm not having any luck.
>>It looks like this:
>>
>>UPDATE TAB1 JOIN TAB2 ON TAB2.FIELD = TAB1.FIELD SET TAB1.PK = TAB2.PK
>>
>>I want to update TAB1.PK with TAB2.PK where TAB1.FIELD = TAB2.FIELD and there's an one to one relation between the two FIELD:s.
>>I don't know what I'm doin wrong but all TAB1.PK equals record no one PK in TAB2.
>>Any ideas???
Magnus Nordin
VFP MCP

"We have tested the GUI on 5-year olds. Why? Beacuse they aren't braindead!"
Michael Spindler, Apple

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform