Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using an sql statement as a condition in another action
Message
De
31/03/2000 16:46:48
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvanie, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00353571
Message ID:
00353651
Vues:
20
>UPDATE myTable SET mytable.field3 = .t. WHERE field2 in (SELECT field2 from myTable GROUP BY Fileld2)

I tried something like that in VFP6SP3 and it kep telling me that the subquery was invalid. I tried the subquery as a main query, and it executed properly.

Given that the end result is to have field3=.T. for those records whose field2 value does not occur anywhere else (field2 is unique) the subquery needs to be more like:

Update mytable set field3=.T. where field2 in (Select field2, CNT(FIELD2) as F2CNT from myTable group by field2 HAVING F2CNT=1)

This syntax would be ideal, but i couldn't make it work- so i offered an xBase solution which is probably an order of magnitude more clumsy.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform