我有2个表,其中包含以下内容:
表格1
start | end | pcs
0840 1030 35
1040 1230 30
表2
timestamp | line
0841
0842
1041
1042
我想从table1的时间范围计算table2的每个时间的总计数吗?
我希望有人能得到这个,
谢谢
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]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句