SQL: Using two dates from other query to select data between date interval
I am new to SQL and I am facing a complicated problem.
My table T2 contains start_date and end_date, two time stamps. Table T1
contains a time-stamp ts and values v for that.
I would like to use the pairs of time-stamps in T2 to obtain values v from
T1 between those pair of dates. I tried something like below but it will
not work. I would appreciate your help with pointing me to the problem.
select v, circle_ts from t1 where circle_ts between start_ts and end_ts in
(select start_ts, end_ts from t2 where meter_id = 10)
No comments:
Post a Comment