资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

新手求救:大家看看这两个SQL语句怎么写!(在线等,解决了就给分)

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

1.数据库中有个DateTime类型的ReleaseDate,  
      我想select   ReleaseDate排在最近10位的记录。  
  2.数据库中有个string类型的title,  
        我想select   ,当title的长度大于20时,title为   title的前20个字符+"...",  
                                    而当title的长度小于20时,则不变,为title.  
 

网友回答:

发表者:Bulemaple

select   top   10   ReleaseDate   from   your_table  
  select   title=case   rtrim(len(title))   when   20   then   title   else   left(title,20)+...   as   title   from   your_table

发表者:cdo

1.   select   top   10   *   from   (select   *   from   表名   order   by   字段名)   a         ---------a为新表名  
  2.   select   title=(case   when(len(title)>5)   then   left(title,5)+...   else   title   end)   from   表名


 

 
热门推荐笔记本: 宏碁笔记本
相关文章:
笔记本相关:
IT技术文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved