Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL question
Message
From
13/02/2017 08:56:29
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01647876
Message ID:
01647881
Views:
94
select id from table1 where id not in (Select id from table2) into cursor t_idmiss

not certain if not exists is supported in vfp at the moment...





>Hi:
>I have two tables: table1 and table2. Each has one text field in common: ID, containing a 9 character code that is unique for each record. However, whereas table1 has 10,000 records, table2 has 200. But some of the ID's found in table2 do not exist in table 1. Using set relation and filter, I can find the table1 id's that are missing from table2. I am wondering whether this could also be done with an SQL statement?
>
>
>CLOSE ALL
>USE
>USE table2
>INDEX on id TO id2
>
>SELECT 2
>USE table1
>INDEX on id TO id1
>
>SELECT 1
>SET RELATION TO id INTO table2
>SET FILTER TO table2.id  == " "  && or == ""
>SELECT 2
>DELETE ALL 
>SET FILTER TO 
>SET FILTER TO DELETED()
>BROWSE && for instance
>
>
>I thought that an SQL statement such as the following might be equivalent, but it isn't:
>
>
>SELECT * ;
>FROM table1, table2 ;
>WHERE table1.id <> table3.id 
>
>
>Thank you, Steve
Previous
Reply
Map
View

Click here to load this message in the networking platform