Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subquery in UPDATE SQL?
Message
De
16/07/2004 15:04:46
 
 
À
16/07/2004 10:34:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00924713
Message ID:
00925310
Vues:
24
>>Can you have a subquery in an UPDATE SQL?
>>
>>Brenda
>
>Yes, but I think prior to VFP 9, it can't be a correlated subquery. That is, it can't reference fields from the update table directly.
>
>Tamar

Hi Tamar,

Of course, you can use correlated sub-query in UPDATE in previous VFP versions.
CLEAR 
CREATE CURSOR foo (f1 I, f2 I)
INSERT INTO foo VALUES (1,2)
CREATE CURSOR bar (f3 I, f4 I)
INSERT INTO bar VALUES (1,3)
INSERT INTO bar VALUES (1,4)
INSERT INTO bar VALUES (1,2)
SELECT foo
LIST
UPDATE foo SET f2=f2+1 WHERE f2=(select MIN(f4) from bar WHERE f3=f1)
SELECT foo
LIST
Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform