我在表里有一个字段aa 是datetime类型的 其中有几个值为‘04-08-19’的记录 我想用select.....where ......把08-19的记录过滤出来 该怎么写呢? 不管是哪一年的 只要是符合08-19就过滤出来 急啊。。给各位老大磕头了谢谢

解决方案 »

  1.   

    什么数据库的?? 应该不是ORACLE的。。你把 datetime转换为string然后substring后面几位, 再与 08-19比较不就可以了么>>>比如ORACLE
    select * from yourtalbe where substr(to_char(thedate,'yyyy-mm-dd'),6,5)='08-19'楼主别说的这么。可怜吧
      

  2.   

    如果是SQL
    WHERE month(aa) = 8 and day(aa) = 19
      

  3.   

    我试过了,SQL里面肯定可以
    而oracle 按照 beyondtkl(大龙驹<逝追.弗瑞德>) 说的也是个办法,不用。。了,给分就行。受不起
      

  4.   

    Select * from Table where day(aa) = 19 and month(aa) =08
      

  5.   

    WHERE month(TheField) = 8 and day(TheField) = 19
    就对啦 yuanscar(塑料树) 你可这快阿
      

  6.   

    yuanscar(塑料树)的没问题:
    WHERE month(aa) = 8 and day(aa) = 19
      

  7.   

    select * from aaa where aaa.theDate between convert(datetime, '2004-08-19')-3 and convert(datetime, '2004-08-19')+3
      

  8.   

    select * from bingren
    where substring((convert(varchar(5),datime,10)),1,5)='08-19'