select 编号, 值, 日期
from 表
where 编号=(select 编号 from 表 group by 编号 having sum(值)>=400)
order by 编号,日期
compute sum(值) by 编号

解决方案 »

  1.   

    select * from 表 where 编号 in (select 编号 from 表 group by 编号 having sum(值)>=400)
      

  2.   

    select * from 表 where 编号 in (select 编号 from 表 group by 编号 having sum(值)>=400)
      

  3.   

    select * from 表 where 编号 in (
    select 编号 from 表 where  日期 between 开始时间 and 结束时间 group by 编号 having sum(值)>=规定值 )
    order by 日期