Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do this with sql
Message
 
 
To
24/06/2011 22:53:22
Mk Sharma
Shrishti Solutions
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01515989
Message ID:
01516033
Views:
93
  UPDATE nc SET nc.address1 = oc.address1 ;
    FROM newcustomer nc JOIN oldcustomer oc ON oc.PK = nc.PK ;
    WHERE EMPTY(nc.address1) AND NOT EMPTY(oc.address1) 

  UPDATE nc SET nc.address2 = oc.address2 ;
    FROM newcustomer nc JOIN oldcustomer oc ON oc.PK = nc.PK ;
    WHERE EMPTY(nc.address2) AND NOT EMPTY(oc.address2) 

  INSERT INTO newcustomer ;
    SELECT * FROM oldcustomer oc WHERE oc.PK NOT IN (  SELECT PK FROM newcustomer  ) 
>
>use 1001\customer again in 0 alias oldcustomer shared 
>use 1002\customer again in 0 alias newcustomer shared
>sele newcustomer
>set order to accode
>sele oldcustomer
>set order to accode
>go top
>do while not eof('oldcustomer')
>     scatter memvar
>     sele newcustomer
>     if  not seek(m.accode,'newcustomer','accode')
>         appe blank in newcustomer
>         gather memvar
>    else
>          if empt(newcustomer.address1)
>             repl newcustomer.address1 with m.address1 in newcustomer
>         endif
>          if empt(newcustomer.address2)
>             repl newcustomer.address2 with m.address2 in newcustomer
>         endif
>    endif
>    sele oldcustomer
>    skip
>enddo
>
>
>
>how to do this with sql.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform