Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update from another table.
Message
From
08/12/2005 18:09:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01076432
Message ID:
01076448
Views:
22
>Hi.
>Is it possible to update a table's field from another one's? I mean, something like... (I know this doesn't work, ok??)
>
>update mytable set myfield = othertable.otherfield where othertable.keyfield=mytable.keyfield
>
>Thanks a lot in advance...

It works just as you write but you need to select othertable and if would scan the table:
select othertable
scan
 update mytable set myfield = othertable.otherfield ;
    where othertable.keyfield=mytable.keyfield
endscan
Replace is easier.
select myTable 
replace myfield with othertable.otherfield ;
    for seek(mytable.keyfield,'othertable','keyfieldtag')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform