Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating one field of records from another table
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00581256
Message ID:
00583439
Views:
30
>Update TableB set FieldTotal = (select TableA.FieldTotal from TableA where TableA.FieldPersonName + DTOS(SomeDate) in (select FieldPersonName + DTOS(SomeDate) from TableB))

I added an Update at the bottom of my reply. I mainly work with Oracle as my database and the SQL above works there. Unfortunately, VFP does not support that kind of sub-query.

>select TableA
>set order to NameDate && index tag on FieldPersonName + DTOS(SomeDate)
>select TableB
>set relation to FieldPersonName + DTOS(SomeDate) into TableA
>replace all FieldTotal with iif(eof('TableA'), 0, TableA.FieldTotal)

The code above should work.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform