home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / 8657 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.2 KB  |  36 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!bgsuvax!att!mcdchg!chinet!les
  3. From: les@chinet.chi.il.us (Leslie Mikesell)
  4. Subject: Re: FoxPro problem with outer join (Really UPDATE)
  5. Message-ID: <BzoDuE.FKE@chinet.chi.il.us>
  6. Organization: Chinet - Public Access UNIX
  7. References: <1992Dec21.012636.28374@gopher.dosli.govt.nz> <1992Dec21.205208.39096@datamark.co.nz>
  8. Date: Tue, 22 Dec 1992 19:23:01 GMT
  9. Lines: 25
  10.  
  11. In article <1992Dec21.205208.39096@datamark.co.nz> david@datamark.co.nz (David Rowland) writes:
  12.  
  13. >>The key is common to the two tables, but table2 has only a subset of the
  14. >>key values that are present in table1.  I would like to do is replace the
  15. >>field2 values in table1 for which there is a corresponding key in table2,
  16. >>leaving the rest of table1 untouched.
  17. >>
  18. >
  19. >SELECT 0
  20. >USE table2 ORDER unique_key
  21. >
  22. >SELECT 0
  23. >USE table1 ORDER unique_key
  24.     >SET RELATION TO unique_key INTO table2
  25.     >GO TOP
  26.     >
  27.     >SCAN FOR table1.unique_key = table2.unique_key
  28.     >     REPLACE table1.field1 WITH table2.field1
  29.     >ENDSCAN
  30.  
  31. Instead of the indented section, why not just:
  32. UPDATE ON unique_key FROM table2 REPLACE field2 WITH table2.field2
  33.  
  34. Les Mikesell
  35.   les@chinet.chi.il.us
  36.