select * from table1 where col1 between '2005-06-09' and '2005-07-23'

解决方案 »

  1.   

    select * from 表 where col1 between '2005-06-09' and '2005-07-23'
    还可用
    select * from 表 where + if 语句
    例 
    if(datatimefrom.Length > 0)
    {
    strsql += "  AND 表.字段名>='"+datatimefrom+"'";
    }
    if(datatimeto.Length > 0)
    {
    strsql += "  AND 表.字段名>='"+datatimeto+"'";
    }
      

  2.   

    select * from table1 where col1 between '2005-06-09 00:00:00' and '2005-07-23 23:59:57'