Help with two table query - Mailing list pgsql-general

From Joost Kraaijeveld
Subject Help with two table query
Date
Msg-id B9095DA2D217D511929B00A0C94989FE0BD669@obelix.askesis.nl
Whole thread Raw
Responses Re: Help with two table query  (Darren Ferguson <darren@crystalballinc.com>)
List pgsql-general
Hi everyone,

I have two tables. I want get all the rows (orderManagers) that are in table
2 that are not in table 1.

Table 1 has the following columns:
    district
    orderManager
    salesItemType
    priority

Table 2 has the following columns:
    orderManager
    salesItemType
    priority

The query I came up with is:

SELECT Table2.orderManager FROM Table1, Table2
            WHERE
            Table1.district  = '1990-01-01-00-02-04-000001'
            AND
            Table1.salesItemType  = '1990-01-01-00-02-16-000001'

            AND
            Table2.salesItemType  = '1990-01-01-00-02-16-000001'

            AND
            Table1.orderManager  != Table2.orderManager

But this query does not produce the expected result. The query just returns
all orderManagers from Table2 that have the required salesItemType.

Can anyone help me with this?

TIA

Joost


pgsql-general by date:

Previous
From: "Tom Sheehan"
Date:
Subject: Re: where can I find latest jdbc driver for postgresql?
Next
From: "Tom Sheehan"
Date:
Subject: Re: where can I find latest jdbc driver for postgresql?