Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple Update SQL
Message
From
07/04/2004 11:08:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00892931
Message ID:
00892936
Views:
23
This message has been marked as the solution to the initial question of the thread.
>Need a simple SQL to update a code table. We are converting the codes and need to match the current code with the code_old and replace with the code_new.
>
>codes.dbf has codes.code
>code_conv has code_conv.code_old, and code_conv.code_new
>
>The SELECT is the following but I am having trouble with the UPDATE
>
>SELECT a.code, b.code_old, b.code_new FROM CODES a, code_conv b where a.code = b.code_old
>
>Brenda
select code_conv
scan
 update codes set code = code_conv.code_new ;
   where code == code_conv.code_old
endscan
Or assuming indexed :
select codes
set exact on
replace code with code_conv.code_new ;
  for seek(code, 'code_conv', 'code_old')
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
Next
Reply
Map
View

Click here to load this message in the networking platform