我的表结构如下:表名(Table1);StrDate(时间字段)
求一SQL 查询语句如下(  MS-SQL Server 数据库):
求:2003-02-08 00:00:01 到 2006-09-12 23:59:59 时间内所有 下午15:31:21到22:30:50
的有关数据?对答对者立即给分!

解决方案 »

  1.   

    where StrDate >= '2003-02-08 00:00:01' and strdate <= '2006-09-12 23:59:59 '
    and convert(char(10) , StrDate ,108) >= '15:31:21' and convert(char(10) , StrDate ,108) <= '22:30:50'
      

  2.   

    好像可以给分了全角换成半角
    where StrDate >= '2003-02-08 00:00:01' and strdate <= '2006-09-12 23:59:59 '
    and convert(varchar(8) , StrDate ,108) >= '15:31:21' and convert(varchar(8) , StrDate ,108) <= '22:30:50'
      

  3.   

    where (StrDate between '2003-02-08 00:00:01' and '2006-09-12 23:59:59 ') and
    (convert(char(10) , StrDate ,108)  between '15:31:21' and  '22:30:50')
      

  4.   

    where StrDate between '2003-02-08 00:00:01' and '2006-09-12 23:59:59 '
    and convert(char(10) , StrDate ,108) >= '15:31:21' and convert(char(10) , StrDate ,108) <= '22:30:50'
      

  5.   

    select * from Table1 
    wehre (StrDate between '2003-02-08 00:00:01' and '2006-09-12 23:59:59')
    and (convert(char(8),StrDate,108) between '15:31:21' and '22:30:50')