有一表中
字段:
id(char);
pdate(char)因为这是从文本中读入数据库的,是否可以转为日期型的;
模块(char);
id          pdate             模块
....
5          2003-11-06          ***
6          2003-11-06          ***
7          2003-11-07          ***
8          2003-11-07          ***
9          2003-11-07          ***         
10          2003-11-08          ***         
11         2003-11-09          *** 
....
怎么调出时间从2003-11-06到2003-11-08的所有纪录

解决方案 »

  1.   

    select * from table where  pdate>='2003-11-06' and pdate<='2003-11-08'或者
    select * from table where  left(pdate,10)>='2003-11-06' and left(pdate,10)<='2003-11-08'
      

  2.   

    select * from table where  pdate>=#2003-11-06# and pdate<=#2003-11-08#
      

  3.   

    你应该把pdate(char)定义为datetime数据类型,
    mssql 用: nebbish(nebbish) ( ) 的select * from table where  pdate>='2003-11-06' and pdate<='2003-11-08'
    access 要用:qian1126(阿Q) ( ) 的select * from table where  pdate>=#2003-11-06# and pdate<=#2003-11-08#
      

  4.   

    select * from table where  CONVERT(chr(8),pdate,102)>='20031106' 
    and CONVERT(chr(8),pdate,102)<='20031108'
      

  5.   

    select * from tableName where  datediff(dd,pdate,'2003-11-06')<=0 and datediff(dd,pdate,'2003-11-08')>=0