当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·一个应用的问题,请大家看看    »显示摘要«
    摘要: 表 total innerid,date,outlet,total 表 sales innerid,date,outlet,model,sales 表 total relation 表 sales as innerid 表 models model total和sales是一对多关系。 下面是找出缺少的model select from total a right join models ......
    摘要: <body onload="abc()"> 不对吗? ......


高分求一可行性方案

我建了个表,内有两个字段:  
                                        到站时间   、发车时间    
                                          起点站           4:20  
                                            5:00             5:10  
                                            5:50             6:00  
                                            6:30             6:35  
                                            7:10             终点站  
                                 
  要求:1、将时间显示为以上这种格式  
              2、可以对以上字段值进行大小比较,  
              3、里面的“起点站”、“终点站”标志也要有  
   
  我遇到的问题:  
  1、时间格式如果用日期型的话,sql   server   2000中会连秒也显示出来,如:5:00--->05:00:00,这样很难看。而且不能满足第3个要求  
   
  2、如果用   char型的话,我担心,将来对它按时间区域查询不好实现。  
  因为我要求查询如     5:05之后发车   符合条件的车次  
  考虑到里面含有“起点站”和“终点站”标志,我不知道能不能实现  
   
  以上两种类型方案均有不足,还望高手给小弟一个可行的方法  
  谢谢了先!  
   
   
 

NO.1   作者: pengdali

如果你是用datetime存储你的时间,其他的你可以不用去管它  
  你在显示的时候:  
   
  select   isnull(convert(char(5),到站时间,108),起点站),isnull(convert(char(5),发车时间,108),终点站)   from   表

NO.2   作者: Rewiah

解决小时问题  
   
  select   case   when   到站时间=-1   then   起点站    
  when   到站时间>=3600   then   convert(varchar(10),到站时间/3600)+:+right(0+convert(varchar(10),(到站时间%3600)/60),2)+:+right(0+convert(varchar(10),到站时间%60),2)    
  else   convert(varchar(10),到站时间/60)+:+right(0+convert(varchar(10),到站时间%60),2)  
  end   as   到站时间,  
  case   when   发车时间=-1   then   终点站    
  when   发车时间>=3600   then   convert(varchar(10),发车时间/3600)+:+right(0+convert(varchar(10),(发车时间%3600)/60),2)+:+right(0+convert(varchar(10),发车时间%60),2)    
  else   convert(varchar(10),发车时间/60)+:+right(0+convert(varchar(10),发车时间%60),2)  
  end   as   发车时间,  
  发车时间-到站时间   as   停留秒数  
  from   tablename    
 


    摘要: 1.我想要richedit的每5个字符一种颜色?怎么办? 2.怎样在richedit的背景上画一些横线,做出类似稿纸的效果? 3.那种全屏效果怎么做? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE