Hi Bill,

Try joining your table to itself, and making your criteria part of the join ie.
SELECT A.document from tblDocCharacteristics A 
INNER JOIN tblDocCharacteristics B
ON A.document = B.document
AND A.characteristic = 'a'
AND B.characteristic = 'b'

Regards Simon.
You may have done this already... since a document can have many characteristics, you 
should have a documents table and a characteristics table.

-----Original Message-----
From: Bill Conlon [mailto:[EMAIL PROTECTED]
Sent: 10 July 2003 17:03
To: [EMAIL PROTECTED]
Subject: Witango-Talk: OT: SQL help


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


********************************************************************
This message is intended only for the use of the person(s) ("the intended
recipient(s)") to whom it is addressed. It may contain information which is
privileged and confidential within the meaning of applicable law. If you 
are not the intended recipient, please contact the sender as soon as
possible. The views expressed in this communication may not necessarily
be the views held by LGCSB (Local Government Computer Services Board).
 
Any attachments  have been checked by a virus scanner and appear to be 
clean.
Please ensure that you also scan all messages, as LGCSB does not accept
any liability for contamination or damage to your systems.
********************************************************************


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

Reply via email to