SQL - How to join on similar (not exact) columns
- by BlueRaja
I have two tables which get updated at almost the exact same time - I need to join on the datetime column.
I've tried this:
SELECT *
FROM A, B
WHERE ABS(DATEDIFF(second, A.Date_Time, B.Date_Time) = (
SELECT MIN(ABS(DATEDIFF(second, A.Date_Time, B2.Date_Time)))
FROM B AS B2
)
But it tells me:
Multiple columns are specified in an…