I think the operator you are looking for is "in" or the inverse "not in".

You want to evaluate if a document is within 2 groups in the first example. The first group is:

select doc from table where characteristic = 'a'

The second group is:

select doc from table where characteristic = 'b'

So, to find out if a document exists in BOTH groups, the SQL Select would be in a directDBMS action like:

select doc from intest where
(doc in (select doc from intest where characteristic = 'a'))
and
(doc in (select doc from intest where characteristic = 'b'));

Your second example:

select doc from intest where
(doc in (select doc from intest where characteristic = 'a'))
and
(doc in (select doc from intest where characteristic = 'd'));


except according to your table, the third example should give you one row of doc 1.


Robert.



On Thursday, July 10, 2003, at 09:03 AM, Bill Conlon wrote:

I picked my SQL in the street, so it's kind of rudimentary.  Maybe
someone can point me in the right direction.

Here's a table

document  characteristic
1         a
1         b
1         d
2         a
2         d
2         e
3         a
3         b

I want to SELECT the document(s) that match all of a set of
characteristics.

Say I want all documents with characteristic a AND b: This should return
documents 1 and 3


Likewise, requesting characteristics a AND d returns documents 1 and 2

Say I request characteristics b AND d: I should get no rows.

thanks

Bill Conlon

To the Point
345 California Avenue Suite 2
Palo Alto, CA 94306

office: 650.327.2175
fax:    650.329.8335
mobile: 650.906.9929
e-mail: mailto:[EMAIL PROTECTED]
web:    http://www.tothept.com


_______________________________________________________________________ _
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf




--


Robert Garcia
President - BigHead Technology
CTO - eventpix.com
2781 N Carlmont Pl
Simi Valley, Ca 93065
ph: 805.522.8577 - cell: 805.501.1390
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/ - http://theradmac.com/

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf

Reply via email to