>Hi All,
>
>It's Monday... what can I say? I cannot recall the SQL syntax for updating the values in one table with values from another. I have a customer table. I want to populate the average payment age with values computed from other transaction tables. The common field is customer ID.
>
>It should start like this...
>
>UPDATE customer ;
> set customer.avgage with temptable.avgage ;
> Where customer.id == temptable.id
>
>and there is a clause that needs to be at the end to have each customer.ID validated and updated by the temptable.
>
>Right now I can get one record to update... I guess I must have learned something new and this is the information that got replaced in my pea brain... wee haw!
>
>Thanks!
Hi Paul,
You may do something like that in SQL Server but not in VFP because VFP UPDATE command doesn't support table join. In VFP you have a couple of choices.
SELECT temptable
SCAN
UPDATE customer ;
set customer.avgage with temptable.avgage ;
Where customer.id == temptable.id
ENDSCAN
SELECT temptable
INDEX ON id TAG id
SET ORDER TO id
SELECT customer
SET RELATION TO id INTO temptable
REPLACE customer.avgage with temptable.avgage ;
FOR FOUND("temptable")
--sb--