首先有一个表里面每天有24条数据,就是每个整点一条   字段 ID  date   a  b  c  select id, date,max(MaxNum) MaxNum  from(select CONVERT(varchar(13), date,120)  date,id,  case when a<b then( case when b<c then c else b  end) else(case when a<c then c else a end)   end  as MaxNum  from tb  where  )    as t3 group by id,date
 语句取出 最大值,和那一天的值,但是具体到那个时间点就不知道了,怎么把具体的date 年月日时分拿到

解决方案 »

  1.   


    select id, date,max(MaxNum) MaxNum  from(select CONVERT(varchar(13), date,120)  date,id,
      case when a<b then( case when b<c then c else b  end) else(case when a<c then c else a end)
       end  as MaxNum  from tb  ) 
       as t3 group by id,date
      

  2.   

    你是对date那列如何拆分成时分秒不会还是不会如何取数据?举些例子来看看