Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using an sql statement as a condition in another action
Message
From
31/03/2000 16:46:48
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvania, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00353571
Message ID:
00353651
Views:
19
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform