Re: HELP WITH A QUERY - Mailing list pgsql-novice

From Jean-Yves F. Barbier
Subject Re: HELP WITH A QUERY
Date
Msg-id 20101125003528.09cabaee@anubis.defcon1
Whole thread Raw
In response to HELP WITH A QUERY  (JORGE MALDONADO <jorgemal1960@gmail.com>)
List pgsql-novice
On Wed, 24 Nov 2010 17:16:47 -0600, JORGE MALDONADO
<jorgemal1960@gmail.com> wrote:



> I have 2 tables and each one has a date field. Is it possible to write a
> simple query to get the records with the dates in table1 but not in
> table2? For example:
>
> TABLE 1
>
> -----------------------------------------------------------------------------
> Branch_Name    Sales    Date
> -----------------------------------------------------------------------------
> Los Angeles        1500     May-15-2010
> San Diego            250      May-27-2010
> Los Angeles         300      May-28-2010
> Boston                 700      May-28-2010
>
>
> TABLE 2
>
> -----------------------------------------------------------------------------
> Date                       Sales
> -----------------------------------------------------------------------------
> May-27-2010             250
> May-20-2010             535
> May-21-2010             320
> May-22-2010             750
>
> The query result should be:
> May-15-2010
> May-28-2010
>
> I guess that a query with a subselect and the EXCEPT keyword would work
> but I would like to know if there is a simpler alternative?

Could you be more precise:
* what are common point(s) between tables?
* what do you really want?
* what column(s) is involved in the SELECT criterium?

--
But sex and drugs and rock & roll, why, they'd bring our blackest day.

pgsql-novice by date:

Previous
From: JORGE MALDONADO
Date:
Subject: HELP WITH A QUERY
Next
From: Jasen Betts
Date:
Subject: Re: HELP WITH A QUERY