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

    摘要: 本人想用oci连接oracle把读出的数据写到文件里。请问如何实现。有相关资料的请发mail ningzr@neusoft.com谢谢 ......
 ·菜鸟问题,请高手指教    »显示摘要«
    摘要: 请问一下 “对象实例” 是什么概念? “对象实例”是不是c++中的成员变量? ......


100分求一个复杂的sql查询(100%结贴)

员工编号             打卡时间  
  10                         2005-8-4   17:11:37  
  10                         2005-8-4   17:15:37  
  10                         2005-8-4   20:11:37  
  10                         2005-8-5   17:11:37  
  11                         2005-8-5   17:11:37  
  11                         2005-8-5   17:15:37  
  11                         2005-8-5   20:11:37  
  想要得到的结果:选取同一员工编号   在同一日期   打卡时间超过一个小时的打卡时间  
  例:  
  10                         2005-8-4   17:11:37  
  10                         2005-8-4   20:11:37  
  10                         2005-8-5   17:11:37  
  11                         2005-8-5   17:11:37  
  11                         2005-8-5   20:11:37

NO.1   作者: vivianfdlpw

declare   @tb   table(   id   int,dt   datetime)  
  insert   into   @tb  
  select   10, 2005-8-4   17:11:37   union  
  select   10   ,                       2005-8-4   17:15:37   union  
  select   10     ,                     2005-8-4   20:11:37   union  
  select   10   ,                       2005-8-5   17:11:37   union  
  select   11     ,                     2005-8-5   17:11:37   union  
  select   11     ,                     2005-8-5   17:15:37   union  
  select   11     ,                     2005-8-5   20:11:37  
   
  --   查询  
  select   *   from   @tb   t  
  where   not   exists(select   1    
                                        from   @tb    
                                            where   id=t.id   and    
                                                        dt>t.dt   and  
                                                        day(dt)=day(t.dt)   and    
                                                        datediff(hour,t.dt,dt)<=1)  
  order   by   id,dt  
   
  --结果  
  /*  
  id                     dt                                                                                                            
  -----------   ------------------------------------------------------    
  10.00               2005-8-4   17:15  
  10.00               2005-8-4   20:11  
  10.00               2005-8-5   17:11  
  11.00               2005-8-5   17:15  
  11.00               2005-8-5   20:11  
   
   
  */

NO.2   作者: rivery

--抱歉。上面应该用升序的。说明是对的,但是代码写成了desc  
  --测试表及数据  
  declare   @t   table(   id   int,dt   datetime)  
  insert   into   @t  
  select   10, 2005-8-4   17:11:37   union  
  select   10   ,                       2005-8-4   17:15:37   union  
  select   10     ,                     2005-8-4   20:11:37   union  
  select   10   ,                       2005-8-5   17:11:37   union  
  select   11     ,                     2005-8-5   17:11:37   union  
  select   11     ,                     2005-8-5   17:15:37   union  
  select   11     ,                     2005-8-5   20:11:37  
   
  select   id,(select   top   1   dt   from   @t   where   id=a.id   and   convert(varchar(13),dt,120)=convert(varchar(13),a.dt,120)   order   by   dt   )  
  from   @t   a  
  group   by   id,convert(varchar(13),a.dt,120)  
  /*  
  结果  
  id             dt  
  -------------------------  
  10 2005-08-04   17:11:37.000  
  10 2005-08-04   20:11:37.000  
  10 2005-08-05   17:11:37.000  
  11 2005-08-05   17:11:37.000  
  11 2005-08-05   20:11:37.000  
  */


 ·大家帮我看看这个问题    »显示摘要«
    摘要: class a { virtual aa(){}; }; class b :public a { char j[3]; virtual bb(){}; }; class c : public b { char i[3]; public: virtual cc(){}; }; 用sizeof算的话结果分别是4,8,12。c的大小为什么是12啊?感觉应该是16才对。 ......
» 本期热门文章:

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