Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> self join help for an Oracle newbie

self join help for an Oracle newbie

From: Abaza <mabaza25_at_DELETEusa.net>
Date: Thu, 10 Jun 1999 18:45:31 -0500
Message-ID: <7jpijf$122e$1@news.doit.wisc.edu>


Because of poor database design on an application that I inherited, I need to join two tables that have a one to many relationship while only outputting a single record. Specifically, I need to join the two tables on Table A primary key (CustomerID) to Table B's foreign key (CustomerID) while only keeping the record from Table B that has the lowest date value in a second field.

I guess I could use VB to Loop through the two tables but this may take forever...is there a way to do a self join on Table B that grabs only the record with the lowest date for a singel CustomerID and then join this resultset
to Table As? Received on Thu Jun 10 1999 - 18:45:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US