Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Help
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00638949
Message ID:
00639022
Views:
25
>Works like a charm. Now I am trying to delete the records that do not match. How would I do that.
>
>Thanks
>
>Brenda

The DELETE-SQL command is very limited in VFP. It doesn't allow to use WHERE clause to join tables. You'll have to use procedural code.
Select table1
SET ORDER TO custn1_2    && index on custn1+custn2
Select table2
SET RELATION TO custn1+custn2 INTO table1

SCAN FOR NOT FOUND("table1")
    DELETE
ENDSCAN
Or
SELECT * FROM table2 ;
  WHERE custn1+custn2 NOT IN ( SELECT custn1+custn2 FROM table1) ;
  INTO CURSOR crsNotin1 NOFILTER
INDEX ON custn1+custn2 TAG custn1_2    
SET ORDER TO custn1_2
Select table2
SET RELATION TO custn1+custn2 INTO crsNotin1

SCAN FOR NOT FOUND("crsNotin1")
    DELETE
ENDSCAN
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform