首页 > 技术文章 > 发布时间 sql语句

ANLOG 2014-02-10 12:00 原文

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]

 

推荐阅读