Re: Table differences

From: Somaskandan <somas2007_at_gmail.com>
Date: Sat, 13 Jun 2009 08:03:44 -0700 (PDT)
Message-ID: <d4efd359-01fa-407e-bfb5-cd80ed2419bc_at_j32g2000yqh.googlegroups.com>



On Jun 10, 4:47 pm, Thomas Kellerer <FJIFALSDG..._at_spammotel.com> wrote:
> a..._at_unsu.com wrote on 10.06.2009 22:38:
>
> > I'm sure there is a way to do this.  Have not found it yet.
>
> > But, I have 2 tables, different structures.  Both have a date column.
> > I want to get the rows from table A which do not exist in table B,
> > based on the date:
>
> > TABLE A:   COL1, DATE_COL
> > TABLE B:   COL1, COL2, COL3, DATE_COL
>
> > I want to get the rows in TABLE A which are not in TABLE B, based
> > solely on the DATE_COL.  I do not think I can use MINUS due to the
> > column difference.  And, this is going to a user, so cannot use PL/SQL
> > either.....
>
> SELECT *
> FROM table_a
> WHERE date_col NOT IN (SELECT date_col FROM table_b WHERE date_col IS NOT NULL)
>
> You are aware that the DATE datatype in Oracle contains a time part as well?

Yeah. I am aware of that. Date datatype allows

  1. date without time part
  2. date with time part

to be stored. In this case, the person who posted the question didn't mention anything related to time part. If the time part is part of the date and it needs to be ignored then TRUNC needs to be used. If the time part also needs to be considered then the current query will do that exactly. Received on Sat Jun 13 2009 - 10:03:44 CDT

Original text of this message