Код ниже проясняет вопрос в заголовке. Что можно положить в ГДЕ, чтобы оно заработало?
CREATE TABLE #PickedTimes
(StartTime smalldatetime,
EndTime smalldatetime)
INSERT INTO #PickedTimes
VALUES ('2019-01-25 16:05', '2019-01-25 17:05'),
('2019-01-25 19:05', '2019-01-25 20:05')
--Each row is a time range. There would be more in the real situation, and it is desirable to define them this way.
SELECT * FROM #PickedTimes
-- No questions up to here.
SELECT TransactionID, Timestamp
FROM Transactions
WHERE Timestamp -- SOMETHING WITH #PickedTimes. How to make it pick any of the time ranges in #PickedTimes?