select convert(varchar(13), 发布时间, 120) as 时间段, count(*) as 记录条数 from Table group by convert(varchar(13), 发布时间, 120)
where dt between ... and ...条件也不会写???只要符合日期格式就行了
ado1.CommandText :='SELECT COUNT(*),Format(发布时间,:pk1) FROM wbdata GROUP BY Format(发布时间,:pk1)'; ado1.Parameters.ParamByName('pk1').Value :='HH'; ado1.Open ;运行这个出现“不正常地定义参数对象。”请问怎么办?
ado1.CommandText :='SELECT COUNT(*),Format(发布时间,:pk1) FROM wbdata GROUP BY Format(发布时间,:pk1)'; ado1.Parameters.ParamByName('pk1').Value :='HH'; ado1.Open ;//ado1.CommandText :='SELECT COUNT(*),Format(发布时间,:pk1),Format(发布时间,:pk1)这里不这里不能:pk1参数不能这么写,直接ado1.CommandText :='SELECT COUNT(*),Format(发布时间,HH)或拼接变量
from 表
where 发布时间>='2012-3-11 10:00:01' and 发布时间>='2012-3-11 10:59:59'
select convert(varchar(13), 发布时间, 120) as 时间段, count(*) as 记录条数 from Table group by convert(varchar(13), 发布时间, 120)
ado1.Parameters.ParamByName('pk1').Value :='HH';
ado1.Open ;运行这个出现“不正常地定义参数对象。”请问怎么办?
ado1.Parameters.ParamByName('pk1').Value :='HH';
ado1.Open ;//ado1.CommandText :='SELECT COUNT(*),Format(发布时间,:pk1),Format(发布时间,:pk1)这里不这里不能:pk1参数不能这么写,直接ado1.CommandText :='SELECT COUNT(*),Format(发布时间,HH)或拼接变量
这样写说HH参数没找到
from 表
where 发布时间>='2012-3-11 10:00:00' and 发布时间<'2012-3-11 11:00:00'