Re: help with select statement

From: gazzag <gareth_at_jamms.org>
Date: Fri, 16 Jan 2009 02:55:05 -0800 (PST)
Message-ID: <79d5df71-ecb5-49fd-83e6-1b1515304d33_at_r38g2000vbi.googlegroups.com>



On 16 Jan, 05:32, wibni <Boettger.Andr..._at_gmail.com> wrote:
> 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?

Please provide the following:

  1. Oracle version.
  2. DDL to create the relevant tables.
  3. DML to populate the relevant tables.

You will receive more help that way.

HTH -g Received on Fri Jan 16 2009 - 04:55:05 CST

Original text of this message