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

From: Jackie Brock <J.Brock_at_cablelabs.com>
Date: Wed, 14 May 2008 12:51:46 -0600
Message-ID: <B1ED8A2E683E16479C92C3F4AE13677BCC0EEB@srvxchg3.cablelabs.com>


select <col>
from tab1, tab2
where tab1.id <http://tab1.id/> = tab2.id <http://tab2.id/> and tab1.datefield between tab2.datefield - 5/86400 and tab2.datefield + 5/86400  

(assuming my math is correct on seconds in a day!)  

-Jackie  

Jackie D. Brock
Database Specialist - Systems Evaluation CableLabs(r)
858 Coal Creek Circle
Louisville, CO 80027
Email: j.brock_at_cablelabs.com <mailto:j.brock_at_cablelabs.com> 303-661-3347  


        From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Rick Ricky

	Sent: Wednesday, May 14, 2008 12:32 PM
	To: oracle-l_at_freelists.org
	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 = 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? 


--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 14 2008 - 13:51:46 CDT

Original text of this message