我要在一个有年月日的日期里查找只要月日符合的日期的记录。请问如何才能做到??
数据库用access,用ADO连接,使用delphi开发。

解决方案 »

  1.   

    DecodeDate 分解所指定的日期为年、月、日。
    procedure DecodeDate(Date: TDateTime;var Year, Month, Day:Word);
      

  2.   

    直接SQL语句里面加%号模糊查找好了
    select * from tablename where table_date like "%-02-03"
      

  3.   

    用函数decodedate(date,year,month,day);把日期分解.
    select * from table where 字段 like    '''+'%'+inttostr(month)+'inttostr(day)'+'''');
      

  4.   

    如果您的日期字段格式是TDATETIME格式的,那么在数据库中可以使用%或者*统配符,SELECT的WHERE子句中使用LIKE关键字。
    例如:where [日期字段名] like '%[月]-[日]%'
    具体中间的分隔符号,根据系统设置不同而改变。
      

  5.   

    DecodeDate 分解所指定的日期为年、月、日。
    procedure DecodeDate(Date: TDateTime;var Year, Month, Day:Word);
      

  6.   

    datepart('mm','2006-04-20')='04' and datepart('dd','2006-04-20')='20'