我表里定义了一个datetime类型的取货时间,现在我想把今天、明天、后天,三天的取货人数统计出来、和取货人的详细记录显示出来,而表里的取货时间是这样格式的2003-12-20 2:01:00,是带时间的,我怎样设置Adoquery的查询呢?
解决方案 »
- 一个我想不通的问题,大家来讨论讨论
- 如何基于UDP协议实现Internet通讯,急急急!
- 大虾帮忙看看http://expert.csdn.net/Expert/topic/2556/2556311.xml?temp=1.432437E-02
- 一个菜鸟的问题,保证送分
- 一个简单的编程问题
- 求购《delphi6 组件大全》这本书
- DBgrid问题,来者有分
- 取出ntext类型字段的值??
- 能不能实现COMBO BOX象EDIT控件一件READONLY=FALSE类似的状态呢,因为ENABLE = FALSE时太难看了
- 读Unix下的txt文件
- SOS!SOS!
- ado的string不能超过255个字符,你是如何处理这个问题的。
你是说写sql语句来...
'select 你要取的字段 from table where time字段 like'+quotedstr(now);
'select 你要取的字段 from table where time字段 like'+quotedstr(tomorrow);Tomorrow returns a TDateTime value with the date portion set to the day following the current date and the time portion set to 0. 用like可不可以,我没有试过,听别人怎么说..
left(time字段,10)<= dateadd(day,2,date())
select * from table where left(time字段,10) = dateadd(day,2,date()) 后天的取货人的详细记录
left('2003-12-20 2:01:00',10) 就是2003-12-20
date() 就是今天的日期 yyyy-mm-dd
dateadd(day,1,date()) 就是明天的日期
dataadd(day,2,date()) 就是后天的日期select sum(*) as 取货人数 from table where left(time字段,10) >=date() and
left(time字段,10)<= dateadd(day,2,date()) 就是取货人数 够明白了吗
select * from table where datediff('d',date(),取货时间) = 1 // 明天
select * from table where datediff('d',date(),取货时间) = 2 // 后天
select * from table where datediff('d',date(),取货时间) = -1 // 昨天