SQL Dummy Needs Help - Mailing list pgsql-sql

From Alder
Subject SQL Dummy Needs Help
Date
Msg-id 3aa9287b@obsidian.gov.bc.ca
Whole thread Raw
Responses Re: SQL Dummy Needs Help  (Andrew Perrin <aperrin@socrates.berkeley.edu>)
Re: SQL Dummy Needs Help  (Cliff Crawford <cjc26@cornell.edu>)
Re: SQL Dummy Needs Help  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List pgsql-sql
I'm pretty new to SQL and can't figure out how to write what should be a
simple query of two tables.  Could someone here possibly help me out?

Table 1 has two fields I'm interested in: TITLE_NO and EFFECT_DATE
Table 2 also has two fields of interest:    TITLE_NO and PAIDTO_DATE

TITLE_NO is unique in Table 1, meaning each TITLE will have a unique
EFFECT_DATE.  Table 2 represents an accounting history of each TITLE, so for
each TITLE_NO there may be one or more PAIDTO_DATE values.  In both Tables
the _DATE fields are stored as 9-character strings in the fomat YYYYMMDD.
In all cases, the MM and DD values in Table 2 should be identical with those
in Table 1.

My intention is to produce a list that will contain the TITLE_NO of each
TITLE where the MMDD value for EFFECT_DATE differ from any of the
PAIDTO_DATE values for that TITLE_NO.  The list must contain ONLY the
PAIDTO_DATE values that differ, and the corresponding TITLE_NO.

Sorry I can't explain this a little more technically, but if anyone can
advise me, that would be fabulous.

Thanks,
Terry




pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Cannot declare arrays?
Next
From: Andrew Perrin
Date:
Subject: Re: SQL Dummy Needs Help