Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Views - How do I update source tables?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00068429
Message ID:
00068510
Vues:
30
>>>>>
>>>>>I see the problem and corrected the syntax, however when the command runs it only updates the first record in the sourcetbl that meets the condition. There are obviously many more matches. How do I get to them?
>>>>
>>>>Now you have a different problem. :)
>>>>
>>>>UPDATE - SQL works for single tables only. As such, it's only matching with the current value in your child table rather than performing a query like a select.
>>>>
>>>>IMHO, you're better off with a relation and a scan..endscan.
>>>>
>>>>(and this from someone who eats, sleeps, and breathes SQL) :)
>>>>
>>>>Christopher
>>>
>>>The parenthetical means a lot to me. However, I am only trying to update a single source table, just many records in that table. Are you saying that the WHERE clause can not reference values in another table?
>>
>>Not in my experience. I ran a test and got the same results.
>>
>>Just had a thought. Try setting a relation prior to doing the update. That MIGHT work (though a nagging thought says probably not). The problem is that the update command doesn't move the cursor in the child table but rather looks at the current value in that work area, similar to saying "x = customer.custno" does. Then again, maybe I'm having a brain cramp and am missing something obvious. I'll take another hack at it and let you know what I come up with. :)
>>
>>Christopher
>
>Now that I think about it, it isn't that difficult to build the WHERE filter with the same conditions that I built the view on. Still can Use SQL. That option doesn't sound so bad. Thanks for the info. It encouraged my own brain stimulation. Have a happy new year.

I ran a few tests. There was no way to create a join with the update command (as I had suspected). Setting a relationship didn't help (as I also suspected). The easiest way to do this was to set a relationship and then do a mass replace . It's not SQL, but it works. :)

Happy New Year to you too!

Christopher
Christopher Estep

When the student is ready, the master appears.
-- Chinese Proverb
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform