From: | JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | HELP WITH A QUERY |
Date: | 2010-11-24 23:16:47 |
Message-ID: | AANLkTiku9D_tAf0GEsYJO3xpPNpEAc=Kj_YjTke3uB50@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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?
With respect,
Jorge Maldonado
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Yves F. Barbier | 2010-11-24 23:35:28 | Re: HELP WITH A QUERY |
Previous Message | Thomas Kellerer | 2010-11-24 16:43:34 | Re: Running Postgresql on Windows sans install |