各位帮个忙
我在treeview 中+2006年05月 点它能从表(keep)中字段date是datetime类型 就是说能比较把5月的记录全显示出来 select * from keep where date....要怎么写了。
我在treeview 中+2006年05月 点它能从表(keep)中字段date是datetime类型 就是说能比较把5月的记录全显示出来 select * from keep where date....要怎么写了。
from keep
where date >= to_date('2006-05-01','yyyy-mm-dd')
and date <= to_date('2006-05-31','yyyy-mm-dd');
+2006年06月
。。
就是不一定是5月的 难到每个月都要写出来,是不是用变量,怎么写
我用的是sqlserv 2000的
上面这个不行吧
MonthStart,MonthEnd:string;
begin
MonthStart:=FormatDateTime('yyyy-MM-01',self.DateTimePicker1.Date);//所选择月份的1号
MonthEnd:=DateToStr(IncMonth(StrToDate(MonthStart),1));//下月的1号select *
from keep
where date >= StrToDate(MonthStart)
and date < StrToDate(MonthEnd);