发布时间 sql语句

select top 8 name,unit,opinion,Comments,
  case when [createtime]<dateadd(hh,1,[createtime])then '1小时前'  
  when [createtime]<dateadd(day,1,[createtime]) then '1天前'  
   when [createtime]<dateadd(MONTH,1,[createtime]) then '一个月前' 
   when [createtime]<dateadd(YEAR,1,[createtime]) then '1年前' end as tims from [Sjhd_opinion]

 

posted @ 2014-02-10 12:00  小蜗  阅读(329)  评论(16编辑  收藏  举报