那就奇怪了,你试试这个,我在我这试着没问题了 select id,aa,(select min(日期) from tab where 温度>0 and 日期>=aa and id=t.id) bc from (select a.id id,a.日期 aa,a.温度,b.日期 bb,(select avg(温度) from tab where 日期>=a.日期 and 日期 <=b.日期 and id=a.id) cc from tab a,tab b where b.日期=a.日期+4 and a.id=b.id) t where cc>0 and to_char(aa,'yyyymmdd') between '20090101' and '20090316' and aa=(select min(aa) from (select a.id id,a.日期 aa,a.温度,b.日期 bb,(select avg(温度) from tab where 日期>=a.日期 and 日期 <=b.日期 and id=a.id) cc from tab a,tab b where b.日期=a.日期+4 and a.id=b.id) t where cc>0 and to_char(aa,'yyyymmdd') between '20090101' and '20090316')
select id,aa,(select min(日期) from tab where 温度>0 and 日期>=aa and id=t.id) bc
from (select a.id id,a.日期 aa,a.温度,b.日期 bb,(select avg(温度) from tab where 日期>=a.日期 and 日期 <=b.日期 and id=a.id) cc from tab a,tab b where b.日期=a.日期+4 and a.id=b.id) t
where cc>0 and to_char(aa,'yyyymmdd') between '20090101' and '20090316'
and aa=(select min(aa) from (select a.id id,a.日期 aa,a.温度,b.日期 bb,(select avg(温度) from tab where 日期>=a.日期 and 日期 <=b.日期 and id=a.id) cc from tab a,tab b where b.日期=a.日期+4 and a.id=b.id) t
where cc>0 and to_char(aa,'yyyymmdd') between '20090101' and '20090316')