help with select statement

From: wibni <Boettger.Andreas_at_gmail.com>
Date: Thu, 15 Jan 2009 21:32:52 -0800 (PST)
Message-ID: <ba139191-f26a-4425-b235-c64979b9a9d9_at_z27g2000prd.googlegroups.com>



Hi,

I've got the following SQL statement and it is working almost fine.

select distinct cscontact.name, relkeyword.swcode from cscontact, relkeyword where cscontact.pubindex = relkeyword.relpubindex(+) AND (relkeyword.swcode <> 173 OR relkeyword.swcode IS NULL) order by cscontact.name

The statement returns all contacts which have no keyword 173 or no keyword at all assigned to it.
Unfortunately the table relkeyword has more then 1 entry for the same contact person.
1 person might have an entry with keyword 173 and another one with keyword 99.
Currently the entry with keyword 173 is left out but it still shows the line with keyword 99.

I want to leave out a contact completely as soon as it has keyword 173 assigned to it.
Any ideas on how to achieve that? Received on Thu Jan 15 2009 - 23:32:52 CST

Original text of this message