select * from t_product p where 1=1 and p.pdate >= '#1985-01-01 00:00:00#';
这个语句可以查询到一条记录,6月5日存入了一条select * from t_product p where 1=1 and p.pdate <= '#2009-12-31 23:59:59#';
这个语句查询结果为Empty,既然6月5日有一条数据,为什么下面的语句却查不出来。各位大侠帮帮我啊,想不通了

解决方案 »

  1.   

    您这是什么日期格式啊?access?
      

  2.   


    select * from t_product p where 1=1 and p.pdate >= '1985-01-01 00:00:00'; select * from t_product p where 1=1 and p.pdate <= '2009-12-31 23:59:59'; 试试。
      

  3.   

    估计格式不对,pdate的类型是?  
    to_date()看看
      

  4.   

    mysql的不太了解
    但是如果是oracle的话,'#1985-01-01 00:00:00#'; 
     '#2009-12-31 23:59:59#'; 的格式是有问题的
      

  5.   

    这种格式我也试过了,用between and格式也都试过了,就是还是这种现象,解决不了
      

  6.   

    pdate是Date类型的,如果格式不对的话我想应该第一条就查不上来了
      

  7.   

    select * from  t_product ;先把结果集贴上来看
      

  8.   

    product_id(int)   name(string)   descr(string)   normalPrice(double)   memberPrice(double)   pdate(Date)   category(Category类)
          3              javaccg        javaccg         99.9                   99.9         2009-06-0 10:33:43        2我就只是先存储了一条数据作为测试
      

  9.   

    select * from t_product p where 1=1 and p.pdate between '1985-01-01 00:00:00' and 
    '2009-12-31 23:59:59'
      

  10.   

    试过了,是Empty,本来就是这条语句,我拆开了试就出现上面的情况了
      

  11.   

    改变数据库表的话要改比较多的代码了,没听说Date类型不可以的呀