Home » SQL & PL/SQL » SQL & PL/SQL » pair records from 2 tables
pair records from 2 tables [message #335439] Tue, 22 July 2008 03:40 Go to next message
mape
Messages: 241
Registered: July 2006
Location: Slovakia
Senior Member
Hi
I just want to pair records from 2 tables

select * from t_load a, t_gui b
where a.ms=b.ms
and a.account_date between 
 b.create_date  - (160) / (24 * 60 * 60)
 AND a.account_date + (160) / (24 * 60 * 60)




But I will get always some duplicate records.

Does anybody have idea how to easily solve it?

thanks

Re: pair records from 2 tables [message #335442 is a reply to message #335439] Tue, 22 July 2008 03:47 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Supply a test case
Re: pair records from 2 tables [message #335453 is a reply to message #335439] Tue, 22 July 2008 04:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I think the last "a.account_date" should be a "b.account_date"

Regards
Michel
Re: pair records from 2 tables [message #335459 is a reply to message #335439] Tue, 22 July 2008 04:23 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
please give columns of both table with constraints built in
Re: pair records from 2 tables [message #335462 is a reply to message #335439] Tue, 22 July 2008 04:26 Go to previous messageGo to next message
mape
Messages: 241
Registered: July 2006
Location: Slovakia
Senior Member
I didnt catch what you mean.
You mean create constraints on both table? doesn't solve the problem.
Re: pair records from 2 tables [message #335464 is a reply to message #335462] Tue, 22 July 2008 04:28 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
no.. no.. i am just asking you describe the table
and the constraints already created by you in detail
Re: pair records from 2 tables [message #335474 is a reply to message #335462] Tue, 22 July 2008 04:57 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read my post and answer.

Regards
Michel
Previous Topic: Problem with Oracle Keyword
Next Topic: Spool from SP
Goto Forum:
  


Current Time: Sun Dec 04 18:36:06 CST 2016

Total time taken to generate the page: 0.12882 seconds