I have 2 tables which contains the following :
table1
start | end | pcs
0840 1030 35
1040 1230 30
table2
timestamp | line
0841
0842
1041
1042
I would want to compute the total count of each time of table2 from time range from table1?
I hope someone could get this,
thanks
select
t1.[start], t1.[end], count(*)
from table1 as t1
left outer join table2 as t2 on t2.timestamp between t1.[start] and t1.[end]
group by t1.[start], t1.[end]