--StartTime是datetime类型吗?
try:
select Sender,count(*) as count from MReport.A
join MReport.B on MReport.A.ID=MReport.B.ID
where convert(varchar(10),StartTime,120) between '2003-07-09' and '2003-07-10' group by Sender having count(*)>1
try:
select Sender,count(*) as count from MReport.A
join MReport.B on MReport.A.ID=MReport.B.ID
where convert(varchar(10),StartTime,120) between '2003-07-09' and '2003-07-10' group by Sender having count(*)>1
select Sender,count(*) as count from MReport.A
join MReport.B on MReport.A.ID=MReport.B.ID
where convert(varchar(10),StartTime,120) >= '2003-07-09' and convert(varchar(10),StartTime,120)<='2003-07-10' group by Sender having count(*)>1
'select Sender,count(*) as count from MReport.A join MReport.B on MReport.A.ID=MReport.B.ID where StartTime between ''2003-07-09'' and ''2003-07-10'' group by Sender having count(*)>1'
select Sender,count(*) as count from MReport.A join MReport.B on MReport.A.ID=MReport.B.ID where StartTime >= '2003-07-09' and StartTime <= '2003-07-10' group by Sender having count(*)>1
我的程序是这样的.sprintf(sql1,"select Sender,count(*) from MReport.moaMessage,MReport.goaEngineDetail where MReport.moaMessage.ID=MReport.goaEngineDetail.ID where StartTime between '2003-07-09' and '2003-07-10' group by Sender having count(*)>%s",count);....rs->Open (sql1,_variant_t((IDispatch*)cn,true),adOpenStatic,adLockOptimistic,adCmdText);但现在还是不行.
where StartTime<='2003-07-09'
是正确的,
但如果加上andwhere StartTime<='2003-0709' and StartTime>='2003-07-08'
就出现错误了.
应该没有错啊,可能是语句的其他地方