Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating one table with data from another
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00490636
Message ID:
00490641
Views:
10
>Use student in 0
>Use xstud in 0
>Update student set student.cstud_id=xstud.cstud_id where student JOIN xstud on student.cstud_key=xstud.cstud.key

Try this:

update student set student.cust_id = xstud.cust_id where student.cstud_key = xstud.cstud_key

You should'nt need a JOIN.

If that doesn't give the result you want, use a scan loop. The reason I do a scan on small tables is it allows me to come back to the same code later and change other fields without having to rewrite my sql.
select student
scan
    if seek(cstud_key,xstud)
        replace student.cust_id with xstud.cust_id
    endif
    select student
endscan
If your tables are indexed, this would update every student at the largest university in America in a second or two.

HTH
Eric Kleeman - EDS Consulting Services
MCP Visual FoxPro
MCSD C#.NET
Hua Hin Thailand
Los Angeles California
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform