请教各位朋友有谁知道Delphi自带的数据库,通过SQL语句查询日期的写法?(

解决方案 »

  1.   

    select date from table where date = '02-1月-2002'
    或使用formatdatetime
    select date from table where date = (formatdatetime(date),'yyyy-mm-dd');
    ???
      

  2.   

    建立一表,名  kehu.db 其中一字段borth为日期型字段,表单上放置query1,
    datasource1,dbgrid1,datetimepicker1,botton1 等控件,目的是从表中把
    一定时间范围内的数据查询出来,按日期字段。
    1、成功第一次:
    select * from kehu where borth="01/07/05" 2、成功第二次:   Query1.Close;
       Query1.Sql.Clear;
       query1.sql.add('select * from kehu');
       query1.sql.add('where borth='''+datetostr(DateTimePicker1.Date)+'''');
       Query1.Open;   在控制面板区域设置里,修改时间格式为  mm/dd/yyyy  样式,因为无论日期
    格式是怎样,    where borth="10/02/1970"  才能正常查询,所以干脆把日期格
    式改成这样算了。