select count(*) from oa_bg_meeting t where t.begintime-trunc(sysdate,'dd')>0
where后面的怎么解释?begintime-trunc

解决方案 »

  1.   

    t.begintime你的日期
    trunc(sysdate,'dd')当前的日,得到23
    就是说你的开始时间-23天,
    不太懂业务什么关系...
      

  2.   

    -- 查看今天以后(不包括今天 >0 )共有多少次会议............select count(*) from oa_bg_meeting t where t.begintime-trunc(sysdate,'dd')>0
    where后面的怎么解释?begintime-trunc
    -- 个人理解: oa_bg_meeting  表示会议开始的时间
     
    -- select trunc(sysdate,'dd') 表示今天的日期(截断时分秒)
    --  即时、分秒为0 型如:201-06-23 00:00:00
      

  3.   

    意思就是t.begintime开始时间 大于当前日期的0点 例如 t.begintime为20100623 10:00:00 
    trunc(sysdate,'dd') 为 20100623 00:00:00
    where t.begintime-trunc(sysdate,'dd')>0 成立
      

  4.   


     就是找出会议时间大于今天的会议有多少个
    SQL> edi
    已写入 file afiedt.buf  1* alter session set nls_date_format='yyyy-mm-dd'
    SQL> /会话已更改。SQL> select trunc(sysdate,'dd') from dual;TRUNC(SYSD
    ----------
    2010-06-23
      

  5.   


    select count(*) from oa_bg_meeting t where t.begintime-trunc(sysdate,'dd')>0
    /*
    此语句T为表的别名
    t.begintime-trunc 应表示 表 OA_bg_meeting 中的一个属性
    */
      

  6.   

    trunc(date,fmt)按照给出的要求将日期截断,如果fmt=mi表示保留分,截断秒
      

  7.   


    这个SQL是查询 begintime 在当前日期之后的记录。
    select trunc(sysdate,'dd') from dual -- 精确到天,取但天日期0时 
    6/25/2010
    select trunc(sysdate,'mm') from dual -- 精确到月,取月第一天
    6/1/2010
    select trunc(sysdate,'Q') from dual  -- 精确到季度,取季度第一天
    4/1/2010
    select trunc(sysdate,'Y') from dual  -- 精确到年,取年第一天
    1/1/2010