兄弟试试这个:
select plandt,banci,avg(num_result) from (
select to_char(plandate,'YYYY-MM-DD') as plandt
,case when to_number(to_char(plandate, 'hh24 '))>= 0 and to_number(to_char(plandate,'hh24 ')) = 8 and to_number(to_char(plandate,'hh24 ')) = 16 and to_number(to_char(plandate,'hh24 ')) = 0 and to_number(to_char(plandate,'hh24 ')) = 8 and to_number(to_char(plandate,'hh24 ')) = 16 and to_number(to_char(plandate,'hh24 '))
谢谢,这个有效
|