I am trying to query and join two tables from database by connecting to an MS SQL DB server, where the Timestamps from two tables are equal (at 'minute' or "hour" precision).
SELECT
M.TIME,
M.ERRORCODE,
A.TIME,
A.ASSAYNAME
FROM
MESSAGES M, ASSAYS A
WHERE
M.TIME = A.TIME
The problem is the TIME for both tables are like this format "12/07/2015 12:00:12 AM". How am I able to ask SQL only compare the time within more relaxed time frame, say at minute or at hour level.
For example Precision at minute level "12/07/2015 12:00:12 AM" will be considered equal to "12/07/2015 12:00:59 AM"
Precision at hour level "12/07/2015 12:00:12 AM" will be considered equal to "12/07/2015 12:45:59 AM"
Precision at 10 minutes "12/07/2015 12:00:12 AM" will be considered equal to "12/07/2015 12:09:59 AM"
I think another way to ask this question is "Are there ways to evaluate two timestamps by arithmetic" like M.TIME - A.TIME < 10 minutes