datetime 字段的数据是这样的  2004-3-22 10:58:56  
例如就查询 是2004-3-22 这天的数据 该怎样写语句,谢谢了

解决方案 »

  1.   

    select * from transactions 
    where transdate>='2006-02-06' and transdate<'2006-02-07'大于等于指定日期,小于指定日期的后一天
      

  2.   

    两种方法:
    1、where convert(varchar(10), Field, 120) = '2004-03-22'
    2、where Field between '2004-3-22 00:00:00' and '2004-3-22 23:59:59'
      

  3.   

    SQL Server:
    select  U.* from student U where LEFT(datetime,10)='2004-3-20'Oracle:
    select  U.* from student U where substr(datetime,1,10)='2006-02-07'