Re: HELP WITH A QUERY

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: HELP WITH A QUERY
Date: 2010-11-24 23:35:28
Message-ID: 20101125003528.09cabaee@anubis.defcon1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 24 Nov 2010 17:16:47 -0600, JORGE MALDONADO
<jorgemal1960(at)gmail(dot)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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jasen Betts 2010-11-25 01:35:21 Re: HELP WITH A QUERY
Previous Message JORGE MALDONADO 2010-11-24 23:16:47 HELP WITH A QUERY