pixie
pixie

Reputation: 283

Join table to entry if within 30 seconds of Table

Hopefully a quick one.

How do I join a table on a DateTime metric in SQL where I want the left table to be within 30 seconds of the right Table or equal to it?

Thanks

Upvotes: 0

Views: 74

Answers (1)

glaeran
glaeran

Reputation: 426

SELECT *
FROM TableA
INNER JOIN TableB on (a.Value = b.Value or a.Value = dateadd(second,30,b.Value))

Upvotes: 2

Related Questions