我现在有一个表,里面有日期字段(date),现在想先从日期字段中提取出月份,然后,再根据得出的月份值来查询数据,我的代码是这样的:
begin
t1:='6';
clientdataset1.Active:=false;
clientdataset1.CommandText:='select * from HUTAI_FEA where intostr(monthof(T))='''+t1+'''';
//clientdataset1.CommandText:='select * from HUTAI_FEA where T<'''+t1+'''';
//clientdataset1.CommandText:='select * from HUTAI_FEA where (select T FROM HUTAI_FEA)'+ inttostr(monthof(DateTime(select T FROM HUTAI_FEA))) ; //datetimepicker1.Date
clientdataset1.Active:=true;
end;
begin
t1:='6';
clientdataset1.Active:=false;
clientdataset1.CommandText:='select * from HUTAI_FEA where intostr(monthof(T))='''+t1+'''';
//clientdataset1.CommandText:='select * from HUTAI_FEA where T<'''+t1+'''';
//clientdataset1.CommandText:='select * from HUTAI_FEA where (select T FROM HUTAI_FEA)'+ inttostr(monthof(DateTime(select T FROM HUTAI_FEA))) ; //datetimepicker1.Date
clientdataset1.Active:=true;
end;
解决方案 »
- 我用的是fastreport3.0,在设计精确打印的时候发现,fastreport3.0里的尺寸和现实中的不一样,我该怎么做?
- 请教大家一个问题!谢谢!
- 祝大家节日快乐!
- 求教求教
- 为什么我用SHELLLISTVIEW组件时,双击文件时,有部分不能打开,只是隐藏在任务中运行(如TXT文件)
- 我在QRPREVIEW控件中显示报表,调用quickrep的preview方法多次后出现"read stream error"错误,而后就不能再显示报表了,请教各位是什么原因
- 一小段代码?
- 来着有分
- 武汉工作的朋友进来领分!
- 控件装好后用的时候,提示少.dcu为甚么?
- 新手的提问,谢谢大家啦
- Delphie中如何区分类对象的引用和属性的引用,新手求教
t1:='6';
clientdataset1.Active:=false;
clientdataset1.CommandText:='select * from HUTAI_FEA where TO_CHAR(T, 'FMMM')='''+t1+'''';
//clientdataset1.CommandText:='select * from HUTAI_FEA where T<'''+t1+'''';
//clientdataset1.CommandText:='select * from HUTAI_FEA where (select T FROM HUTAI_FEA)'+ inttostr(monthof(DateTime(select T FROM HUTAI_FEA))) ; //datetimepicker1.Date
clientdataset1.Active:=true;
end
不是Oracle就用3楼的吧