新人求教怎么利用返回的多个值作为参数查询下一个数据

新人求教如何利用返回的多个值作为参数查询下一个数据
刚刚开始接触SQL,想用SQL处理一些简单的数据,遇到了问题还请大家帮忙

数据由type_id, int_value, start_time, end_time四个列组成

输入了查询语句

select type_id, int_value, start_time, end_time, (end_time-start_time) from [dbo].[OEE] 
where end_time<1286921701 and start_time>1286885699 and type_id=10 and int_value in (1,2,4)


显示如下结果,是在一点时间范围内,type_id=10, int_value=1,2,4的时间差

新人求教怎么利用返回的多个值作为参数查询下一个数据

现在想要的是将这些结果里面的start和end时间作为时间点来查询type=2, int_value=128的时间段的差值并求和,但是我输入语句


select type_id, int_value, start_time, end_time, (end_time-start_time) from [dbo].[OEE] 
where type_id=2 and int_value=128
and start_time=(select start_time from [dbo].[OEE] as t1 where t1.type_id=10 and t1.int_value in(1,2,4) and t1.start_time>1286885699 and t1.end_time<1286921701) and
end_time=(select end_time from [dbo].[OEE] as t2 where t2.type_id=10 and t2.int_value in (1,2,4) and t2.start_time>1286885699 and t2.end_time<1286921701)


之后,提示返回的值不是单一的值,要做什么样的修改让这个查询继续下去呢?让显示结果在这些时间段内

新人求教怎么利用返回的多个值作为参数查询下一个数据

的type_id=2, int_value=128的时间有多长,并求和

不知道这问题是不是太小白了,希望大家能帮忙看看,非常感谢
------解决方案--------------------
sql select出来的是一个集合的概念,并不是一个值,所以没办法用等于,这边你可以改用in的方式

select type_id, int_value, start_time, end_time, (end_time-start_time) from [dbo].[OEE] 
where type_id=2 and int_value=128
and start_time in (select start_time from [dbo].[OEE] as t1 where t1.type_id=10 and t1.int_value in(1,2,4) and t1.start_time>1286885699 and t1.end_time<1286921701) and
end_time in (select end_time from [dbo].[OEE] as t2 where t2.type_id=10 and t2.int_value in (1,2,4) and t2.start_time>1286885699 and t2.end_time<1286921701)