Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!ucdavis!iris!ambrose From: ambrose@iris.ucdavis.edu (Paul Ambrose) Newsgroups: comp.databases Subject: Re: dBaseIII+ Message-ID: <1785@ucdavis.ucdavis.edu> Date: 19 Apr 88 17:18:41 GMT References: <2413@mandrill.CWRU.Edu> <640@naucse.UUCP> Sender: uucp@ucdavis.ucdavis.edu Reply-To: ambrose@iris.UUCP (Paul Ambrose) Organization: U.C. Davis - College of Engineering Lines: 35 Keywords: dBaseIII+, Existential Quantifiers In article <640@naucse.UUCP> wew@naucse.UUCP (Bill Wilson) writes: >In article <2413@mandrill.CWRU.Edu>, ananth@mandrill.CWRU.Edu (ananth srinivasan) writes: >> I have a problem with dBaseIII+ syntax and would appreciate any help. >> I have two relations with join-able attributes (say ID) and I need >> to find out those ID's that exist in one and don't exist in the other. >> In SQL I can use the NOT EXISTS syntax; in QUEL I can use the >> ANY...=0 syntax; and in Rbase V I can use the SUBTRACT operator >> (which really makes the most sense). My question is what is the >> appropriate syntax in dBase? My DB3 is rusty, but I know the following works: Given two tables, A and B, you can determine records in A that do not have corresponding IDs in B by: select 1 use B index on ID field select 2 use A *(Index A here if desired) set relation on ID into B list field_list_of_A for id <> B->id The *for* condition (<>) will be true for all those records in A that do not have a correspponding ID's in B. Obviously, reversing the A's and B's will give the opposite, that is, all records in B and no corresponding IDs in A. In both cases, the statement: list field_list_of_A for id = B->id will give those records with IDs in both tables. Of course, you can use count, report, label, etc., instead of the list statement.