Link to home
Start Free TrialLog in
Avatar of Ed_Snowden
Ed_Snowden

asked on

Join 2 Tables using datetime fields that are not exact matches

I need to join 2 tables using  datetime fields. Most of the corresponding entries in each table have the exact datetime down to the exact seconds. But some are up between  3 and 50 seconds different.
How can I add a tolerance so that the records join in the 2 tables.

Below is the SQL I'l using at the moment. On the first join I need a tolerance of 50 seconds and on the 2nd join I need a tolerance of 5 seconds.
SELECT     *
FROM         PhoneBill LEFT OUTER JOIN
                      PBXDATA ON PhoneBill.[Call Time] = PBXDATA.CALL_TIME AND PhoneBill.Duration = PBXDATA.DURATION
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ed_Snowden
Ed_Snowden

ASKER

Perfect . Thanks