Dan, you might be able to do this in one select using an outer join
(assuming your DB supports outer joins.) I run into this problem all the
time - where I want to query a "not join" condition.
Here's an example using postgres. Which drugs in the drug table DO NOT have
corresponding records in generics table?
test=# create table drug (name varchar(20));
CREATE TABLE
test=# insert into drug (name) values ('aspirin');
INSERT 48819 1
test=# insert into drug (name) values ('tylenol');
INSERT 48820 1
test=# select * from drug;
name
---------
aspirin
tylenol
(2 rows)
test=# create table generics (name varchar(20), brandname varchar(20));
CREATE TABLE
test=# insert into generics (name, brandname) values ('head-cure',
'aspirin');
INSERT 48823 1
test=# select * from generics;
name | brandname
-----------+-----------
head-cure | aspirin
(1 row)
test=# select * from drug, generics where drug.name = generics.brandname;
name | name | brandname
---------+-----------+-----------
aspirin | head-cure | aspirin
(1 row)
test=# select * from drug left outer join generics on (drug.name =
generics.brandname);
name | name | brandname
---------+-----------+-----------
aspirin | head-cure | aspirin
tylenol | |
(2 rows)
test=# select * from drug left outer join generics on (drug.name =
generics.brandname) where generics.brandname is null;
name | name | brandname
---------+------+-----------
tylenol | |
(1 row)
-----Original Message-----
From: Dan Stein [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 07, 2007 9:40 AM
To: [email protected]
Subject: Witango-Talk: Finding the4 difference between two arrays
I have two arrays
One is all the generic drug names in the drug data table
The other is all the generic names with the categories and sub categories in
the drug cat subcat table
I want to be able to pull back a list of all the drugs in the drug data
table that have not been assigned any category in the drug sub cat able
So I do a search on both tables
I then have two arrays drugs and drugcats
I am having trouble figuring out how to bring back an array of all the
values in the 1st array that are not in the second
--
Dan Stein
FileMaker 7 Certified Developer
Digital Software Solutions
799 Evergreen Circle
Telford PA 18969
Land: 215-799-0192
Cell: 610-256-2843
Fax 215-799-0192 ( Call 1st)
FMP, WiTango, EDI,SQL 2000, MySQL, CWP
[EMAIL PROTECTED]
www.dss-db.com
"The love of one's country is a splendid thing. But why should love stop at
the border? "
Pablo Casals
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf