select * from tblname where input_date>=date(2002,1,1) and input_date<=date(2002,3,3)

解决方案 »

  1.   

    select * from tblname where que_date >= 2002-01-01 and que_date <= 2002-03-03
      

  2.   

    时间的格式要和系统的时间格式一致,我用的oracle,一般都是要用to_date函数的。
    select * from table where date between to_date('2002-01-01','yyyy-mm-dd) and ('2002-03-03','yyyy-mm-dd');
      

  3.   

    使用select语句时,应注意数据库默认的时间问题.
    select * from tblname where que_date >= 2002-01-01 and que_date <= 2002-03-03
    只能选出大于等于2002-01-01 00:00:00小于等于2002-03-03 00:00:00的记录,所以查询条件应修正为que_date >= 2002-01-01 and que_date < 2002-03-04或采用 yuanscar(塑料树) 的between方法.
      

  4.   

    使用Datatime型的select的话,在Sybase里面,缺省就是00:00:00select * from tblname where timing > '2002/01/01' and timing < '2002/03/03'  等价于select * from tblname where timing > '2002/01/01 00:00:00' and timing < '2002/03/03 00:00:00'
      

  5.   

    上面都说的差不多了。
    补充:
    你用的是什么数据库,
    时间的字段的类型,是CHAR型还是DATE型的
    CHAR型:
    SELECT * FROM TABLENAME WHERE TIME > '2002-01-01' AND TIME < '2002-03-03;
    DATE型:
    SELECT * FROM TABLENAME WHERE TIME > TO_DATE('2002-01-01','yyyy-mm-dd) and TIME < TO_DATE('2002-03-03','yyyy-mm-dd');