RE: anyone know how to do a join where the data can be different

  • From: "Bobak, Mark" <Mark.Bobak@xxxxxxxxxxxx>
  • To: "ricks12345@xxxxxxxxx" <ricks12345@xxxxxxxxx>, "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 14 May 2008 14:41:34 -0400

How about:
Select <col>
From tab1, tab2
Where tab1.id = tab2.id
And abs(tab1.datefield-tab2.datefield) <= 5/86400;

-Mark

--
Mark J. Bobak
Senior Database Administrator, System & Product Technologies
ProQuest
789 E. Eisenhower, Parkway, P.O. Box 1346
Ann Arbor MI 48106-1346
+1.734.997.4059  or +1.800.521.0600 x 4059
mark.bobak@xxxxxxxxxxxx<mailto:mark.bobak@xxxxxxxxxxxxxxx>
www.proquest.com<http://www.proquest.com>
www.csa.com<http://www.csa.com>

ProQuest...Start here.

From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Rick Ricky
Sent: Wednesday, May 14, 2008 2:32 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: anyone know how to do a join where the data can be different

I have two different data sets. They come from two different feeds.

I have an ID field that I can join on that is the same in both. However, I have 
a date field in each. Here is the catch, the dates can be up to 5 second apart.

So I have

select <col>
from tab1, tab2
where tab1.id<http://tab1.id> = tab2.id<http://tab2.id>
and tab1.datefield is with in 5 seconds of tab2.datefield

anyone know a way to do this without a lot of complex pl/sql?

Other related posts: