我有个关于发布活动公告的表有三个字段 
主键ID  活动计划开始时间(startTime) 活动计划结束时间(endTime)现在要求查询活动即将开始的记录,即当前时间sysdate在活动计划开始时间之前的记录
我不会写,请求帮助

解决方案 »

  1.   

    select * from tablename where startTime<=sysdate
      

  2.   

    select * from tablename where startTime > to_char(sysdate,'HH24:MI:SS')
      

  3.   

    select * from tablename where startTime>=sysdate and startTime<trunc(sysdate)+1
      

  4.   

     select * from 表 where starttime>=sysdate order by starttime;
      

  5.   

    即将开始 那么sysdate的数据时刻都在变 每一次都不同
    我建议写一段语句 把即将开始时间作为一个参数去比较 这样才更合理
      

  6.   

    对不起,我问题没写全,是如何用一条语句去应对三种情况,(即将开始,进行中,已结束),要求前台用户选择任意一种情况都有返回值,但sql语句只有一句,那么请问三种情况用一个sql语句应对该如何写?谢谢大家。
      

  7.   

    select * from (
    select * from tablename where startTime<=sysdate --即将开始
    union
    select * from tablename where startTime>sysdate  and endtime <=sysdate --已经开始
    union
    select * from tablename where endTime>sysdate --已经结束
    ) order by startTime
      

  8.   

    select * from tablename where startTime<=sysdate and ENDTime<=sysdate